Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I am trying to schedule this backup job using CRON. The test I tried before in which I just scheduled an email to be sent worked fine. But no such luck here.
Here is what I did:
1) I created a file called backup.sh in the /etc/cron.daily folder, which had this as its contents:
tar -czvf /backupdirectory/backup.tgz /directorytobackup
2) I installed this cron job in crontab:
12,32 * * * * /etc/cron.daily/backup.sh
Am I placing the backup.sh file in the wrong directory? Also, do I need to create an .sh file at all? Can't I just put the backup command right in the cron job instead of calling to the backup.sh file?
The syntax you gave tells it to execute at 3:25 PM every day. So it should've executed today. For sanity's sake make sure crond is running and chack your cron log in case there were errors (it should be in /var/log/cron). Also, you might want to provide the full path to tar just to be safe.
I didn't understand what you meaned by "I scheduled and installed". By the manual, all you have to do is enter "crontab -e" as the user owner of that queue. crontab will open your preferred editor for you to edit the job. When you save the edit and close the editor, it does a consistency test of the jobs and submit to the cron queue. You can see the scheduled jobs with "crontab -l".
Oddly, the backup actually ran - precisely an hour after I scheduled it. It was scheduled for 4:35 in the Cron Job and ran at 5:35 instead. To test this, I just scheduled a job for 7:30 in crontab and it ran at 8:30.