[rt-users] RT Backup procedures?

darren chamberlain darren at boston.com
Fri Mar 8 11:40:25 EST 2002


Quoting Richard E. Brown <Richard.E.Brown at DARTWARE.COM> [Mar 08, 2002 11:28]:
> Folks: 
> 
> A while back, there was a thread in rt-users that mentioned there was a 
> backup procedure for RT at ftp://ftp.fsck.com/pub/rt/rt1-contrib  I 
> can't get to that host now.  
> 
> What I really want is a recipe that: 
> 
> a)	Backs up the mySQL database (it can dump all the tables - I 
>       only have RT running) 
> b)	Backs up all my RT source files (from all the places they might 
>       have been placed during the installation process) 
> c)	Backs up anything else that I might need 
> 
> and then 
> 
> d)	Restores all this stuff.  

You could do this with a short shell script (Warning! This is
untested! I just threw this together right now!):

#!/bin/sh

DATE=`date +"%Y-%m-%d"`
RT_PATH=/path/to/rt
MYSQL_OPTS="-urt_user -prt_password -h rt_host RT_DB_NAME"

case $* in
  restore)
    shift
    RESTORE_DATE=$1 
    #
    # Restoe db
    mysql $MYSQL_OPTS < /backups/$RESTORE_DATE/database

    # Restore rt
    cd $RT_PATH
    gunzip -c /backups/$RESTORE_DATE/rt.tar.gz | tar xf -

    ;;
  save)
    # Assumes that /backups exists, of course
    if ! test -d /backups/$DATE; then mkdir /backups/$DATE; fi

    # Backup db and RT dir
    mysqldump $MYSQL_OPTS > /backups/$DATE/database

    tar cf /backups/$DATE/rt.tar $PATH
    gzip --best /backups/$DATE/rt.tar

    ;;
  *)
    echo "Usage: $0 (save|restore)"
    exit 1
    ;;
esac

exit 0

Good luck.

(darren)

-- 
Mosher's Law of Software Engineering:
Don't worry if it doesn't work right.
If everything did, you'd be out of a job.




More information about the rt-users mailing list