Simple Backup Script
Hello Everyone,
My apologies, if this is the wrong forum to post in :(
===================================
I am basically looking for a backup script made using 'rsync'.
I basically need it to copy folders between 2 servers. I am basically moving contents from a live
server to a new server.
a) The script should be able to copy my desired folder
b) The script should mail me once has successfully finished
Can somebody please assist me with such a script. Although i have tried to create one, but i am not sure how
correct it is.
It goes like this :-
#!/bin/sh
echo "* Creating new backup..."
rsync -avz --delete /home/user1/ root@ipaddress -p 1088:/home/USER1/ > rsync-log
cat rsync-log | mail -s "Rsync-log" you@yourdomain.com
exit 0
Please let me know if the above is correct or if it needs some rectification. Thank you for your time everyone !
Please let me know if the above is correct or if it needs some rectification. Thank you for your time everyone !
-
Hello @furquan, You may find the following StackOverflow thread helpful when developing your custom rsync script: rsync via cron. How do I enable logging? Thank you. 0 -
Hello Michael, I am so very sorry, But since i am novice in scripting, I really dint get much there. Can you please review my script posted above and let me know if all is correct in it and can i go ahead'and use it without worry. Appreciate your time. Thank you, 0 -
Hello, It looks correct, but I recommend running the "rsync" command manually first to make sure it works as intended before enabling the script as part of a cron job. Thank you. 0
Please sign in to leave a comment.
Comments
3 comments