nerdtron,
Thanks for the detailed explanation of the rsync commands. I used it in the past with some success to test file transfer from server to server. I will attempt the back up and then eventually restore. Will keep thread posted.
nerdtron,
Thanks for the detailed explanation of the rsync commands. I used it in the past with some success to test file transfer from server to server. I will attempt the back up and then eventually restore. Will keep thread posted.
nerdtron do I need to kill any processes before running the rsync command? I needed Ubuntu Forums to come back up so I could reference the commands. My target date is this Sunday.
Here's how i did it to minimize the downtime on our mail server migration. Execute rsync on the live system with running processes. I t won't affect much of the performance. Also, it will copy the bulk of all emails which could take several minutes.
After that, make the 2 servers offline, the old and the new servers. This will cause email services to stop so please send a notification to them that you'll do a server maintenance.
Now do the rsync again to copy the extra emails that were left out while you were doing the first rsync. You'll do this to make sure you copied everything. This will only take a few minutes (or seconds) depending on the amount of new data that needs to be copied.
Connect the new server to the network to receive the new mails.
OR if you are just going to do a backup and not migration, no need to kill any processes. Just execute the rsync command and it'll do the backup for you.
I've successfully backed up the data. Or so it appears. If I am to understand correctly. The --delete-excluded and --delete switch will make a 1 to 1 copy? meaning if a file is present on the backup but not on the source. It will delete the backup file?
Now how will I go about setting up a cron job/script to automate this? Thanks again for all the help.
Yes. You are correct on the --delete and --delete-excluded switch. If you finished rsync today and then some files where deleted on the source, the next day you rsync, the files on the backup will also be deleted.
I haven't tried this yet but I think it should work. Please make sure that you can login without via ssh without password to the remote server from the local server you are going to execute the rsync command.
Generate keys and don't enter any password. Then copy the keys to the remote server.
Try to ssh to the remote server and you should not be asked for a password.Code:ssh-keygen ssh-copy-id user@remoteserver
Create an empty file and make it executable. Name it rsync.sh and put it in /home/username/rsync.sh
Put in this file you rsync command.
Edit the crontab.
Add a line like this.Code:crontab -e
If you want more control over the crontab schedule, read here and here.Code:@daily /home/username/rsync.sh
nerdtron I believe I have everything set and ready to go. My crontab options for this are "* 6 * * 0". My understanding is this will run @6am every Sunday? If correct I'm good to go and I thank you for your assistance.
Any scripts that need to be run with root privileges like comprehensive backups should be referenced in crontabs owned by root, not by an ordinary user. The simplest solution is to put the scripts, or symlinks to them, in the appropriate /etc/cron.* directories. To run a job once a week, put the script in /etc/cron.weekly. The daily and weekly scripts are run just before 7 am by default. To change these times, edit (as root with sudo) the file /etc/crontab and change the entries appropriately.
If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.
Blog · Linode System Administration Guides · Android Apps for Ubuntu Users
Bookmarks