As of 7-25-06
#!/bin/sh
# ## filename: rsync_backup.sh ## author: dwest@sagonet.com ## description: runs nightly to push updates to corporate backup server. #
## Variables # BACKUP_SVR=corp-backup.tpa.sagonet.net REMOTE_DIR=tiddlywiki RSYNC_USER=tiddlywiki export RSYNC_PASSWORD=*********** RSYNC_OPTS="--force --ignore-errors --delete -av" BACKUP_SVR=corp-backup.tpa.sagonet.net MYSQL_DIR=/usr/home/tiddlywiki/mysql_backups export PATH=$PATH:/bin:/usr/bin:/usr/local/bin DATE=date "+%Y-%m-%d" DAY=date "+%A"
## MySQL Dump of DB # mysqldump -u tiddly -ptiddly tiddlerbackend >> $MYSQL_DIR/tiddlywiki. $DATE.sql
## Full Tar # tar -czvf /home/backups/tiddlywiki_full.$DAY.tar.gz /etc /home/ tiddlywiki /usr/local/etc
## Now the actual transfer # rsync $RSYNC_OPTS /etc $RSYNC_USER@$BACKUP_SVR::$REMOTE_DIR/current rsync $RSYNC_OPTS /home/tiddlywiki $RSYNC_USER@$BACKUP_SVR:: $REMOTE_DIR/current rsync $RSYNC_OPTS /usr/local/etc $RSYNC_USER@$BACKUP_SVR::$REMOTE_DIR/ current/local rsync $RSYNC_OPTS /home/backups $RSYNC_USER@$BACKUP_SVR::$REMOTE_DIR/ current
## Log that the transfer is complete. # logger Rsync of /etc, /home/tiddlywiki, /usr/local/etc and /home/ backups complete.
This command:
tar -czvf /home/backups/tiddlywiki_full.$DAY.tar.gz /etc /home/ tiddlywiki /usr/local/etc
will create a tar.gz backup in the format of tiddlywiki_full.monday.tar.gz that will be stored in the /home/ backups directory. To access this file you will need to have root privileges as the file is created by the root user. To gain root access you can execute the command 'sudo bash -l' and enter the password. This password is the same password you used to login to the machine.
This archive file will have all of the files that you specified that you needed backed up.
/etc /usr/local/etc /home/tiddlywiki and /home/backups (for the full backup.)
This system will always keep 7 days worth of backups.