Just looking for some advice, I have set up a cron job using crontab -e as root that looks as follows,
[root@backup win]# crontab -l
0 23 * * sun tar -zPvcf testbackupSUN.tar.gz /var/www/html
0 23 * * mon tar -zPvcf testbackupMON.tar.gz /var/www/html
0 23 * * tue tar -zPvcf testbackupTUE.tar.gz /var/www/html
0 13 * * wed tar -zPvcf testbackupWED.tar.gz /var/www/html
0 23 * * thu tar -zPvcf testbackupTHU.tar.gz /var/www/html
0 23 * * fri tar -zPvcf testbackupFRI.tar.gz /var/www/html
0 23 * * sat tar -zPvcf testbackupSUN.tar.gz /var/www/html
I am guessing this will work instead of using a path to a script file, question is where will the resulting testbackup<day>.tar.gz file end up?
I then need to rsync these .tar.gz files to a mounted drive, I can do this manually using
rsync -avz /root/sitebackup.tar.gz /mnt/win
but is there anyway to get this into the cron job - I was thinking using a pipe? So for instance
0 13 * * wed tar -zPvcf testbackupWED.tar.gz /var/www/html | rsync -avz /root/sitebackup.tar.gz /mnt/win
I would like to pipe it instead of setting it as another cron job as i am not sure how long it will take to tar the /var/www/html folder as each server has a different number of sites.
Should this work or is there a better, easier, cleaner way to do this? (I am looking into doing an incremental backup using the update switch on the tar but this will do for now - if it works)
If I have to use a script file is there any chance of a pointer as to how to write it?
Thanks for any help