Quote:
Originally Posted by BannerSchafer
30 3 * * * root /bin/backup.sh
|
The above crontab syntax is used for "system" cron jobs that can be found in files located in this directory: /etc/cron.d/
To make the backup work in root's user crontab (not system crontab) the above would need to be changed to look like this:
Code:
30 3 * * * /bin/backup.sh
Notice that 'root' is not specified? That's because you put it in root's user crontab (by typing "crontab -e" and entering the line) so ... naturally ... root will be the user running the /bin/backup.sh script.
All user and root specific cron jobs can be found somewhere in here: /var/spool/cron/ (or thereabouts depending on your distribution).
So if you have a user named tony then his cron jobs would be in a file called /var/spool/cron/tony The 'tony' user can edit his own cron by typing 'crontab -e' ... when he saves it it will go to /var/spool/cron/tony
If there is a system controlled crontab it will be here: /etc/cron.d/ ... and a username needs to be specified here in order to tell cron who to run the line as.
There are also system directories for scripts to be stored and executed by cron as the root user. Your backup.sh script could be moved to: /etc/cron.daily/ ... and it will be executed every day by cron as the root user.
Hope this helps.