LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Scheduled backup question (http://www.linuxquestions.org/questions/linux-newbie-8/scheduled-backup-question-861966/)

stealth13 02-10-2011 11:37 PM

Scheduled backup question
 
How do i create a tar backup (using gzip compression) called /backup/boot_files.cron that will backup the /boot directory monday at 4pm ?

KamasCZ 02-11-2011 12:55 AM

Hi,
you must add a line in /var/spool/cron/crontabs/root like this:
0 4 * 1 * /bin/tar czf /backup/boot_files.cron /boot

then run crontab -e and quit it by :wq

tuxianD 02-11-2011 01:07 AM

Quote:

Originally Posted by KamasCZ (Post 4254787)
Hi,
you must add a line in /var/spool/cron/crontabs/root like this:
0 4 * 1 * /bin/tar czf /backup/boot_files.cron /boot

then run crontab -e and quit it by :wq

I think it has to be -

0 16 * * 1 /bin/tar czf /backup/boot_files.cron /boot

Correct me if I am wrong.

vinodvb 02-11-2011 01:23 AM

Its always recommended to edit the cron file using the command
Code:

crontab -e
and not directly edit the file in the spool directory.
NOTE: Chances are there may not be any file inside the cron directory if there are no cron jobs defined before.

The crontab entry by tuxianD is correct.

So, the steps would be:
1- crontab -e
2- Add the cron job (0 16 * * 1 /bin/tar czf /backup/boot_files.cron /boot)
3- Save and exit (:wq)

KamasCZ 02-12-2011 02:17 AM

Sure, 16 for 4pm :-)

I use my fovorite editor to edit cron files, then just update it with crontab -e, its the same.

JZL240I-U 02-24-2011 03:59 AM

Is this home work?


All times are GMT -5. The time now is 06:39 PM.