Here come some important facts about crontab.
I know, you know. But read it, you might find them interesting.
1. Whenever you issue some cron job either for yourself (i.e. root) or some other person. Cron searches its spool area (/var/spool/cron/crontabs) for crontab files, for every user which is there in /etc/passwd file there is one associated crontab file. If crontab found a cron in this location it will load into memory. You cannot directly edit these file.
"So for a user alok, his crontab location would be /var/spool/cron/alok."
2. Crontab Time issue - Special considerations exist when, for any reason you had changed the system clock time by less than 3 hours.
If the time has moved forwards, those jobs which would have run in the time that was skipped will be run soon after the change.
Likewise, if the time has moved backwards by less than 3 hours, those jobs that fall into the repeated time will not be re-run.
Only jobs that run at a particular time (not specified as @hourly, nor with '*' in the hour or minute specifier) are affected. Jobs which are specified with wild cards are run based on the new time immediately.
Clock changes of more than 3 hours are considered to be corrections to the clock, and the new time is used immediately.
3. If the users account has a crontab but no use-able shell in /etc/passwd then the cronjob will not run. You will have to give the account a shell for the crontab to run.
4. You can not use % in the command area. They will need to be escaped and if used with a command like the date command you can put it in backticks. Ex. `date +\%Y-\%m-\%d`
5. Instead of the first five fields, one of eight special strings may appear:
string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
Enjoy
I know, you know. But read it, you might find them interesting.
1. Whenever you issue some cron job either for yourself (i.e. root) or some other person. Cron searches its spool area (/var/spool/cron/crontabs) for crontab files, for every user which is there in /etc/passwd file there is one associated crontab file. If crontab found a cron in this location it will load into memory. You cannot directly edit these file.
"So for a user alok, his crontab location would be /var/spool/cron/alok."
2. Crontab Time issue - Special considerations exist when, for any reason you had changed the system clock time by less than 3 hours.
If the time has moved forwards, those jobs which would have run in the time that was skipped will be run soon after the change.
Likewise, if the time has moved backwards by less than 3 hours, those jobs that fall into the repeated time will not be re-run.
Only jobs that run at a particular time (not specified as @hourly, nor with '*' in the hour or minute specifier) are affected. Jobs which are specified with wild cards are run based on the new time immediately.
Clock changes of more than 3 hours are considered to be corrections to the clock, and the new time is used immediately.
3. If the users account has a crontab but no use-able shell in /etc/passwd then the cronjob will not run. You will have to give the account a shell for the crontab to run.
4. You can not use % in the command area. They will need to be escaped and if used with a command like the date command you can put it in backticks. Ex. `date +\%Y-\%m-\%d`
5. Instead of the first five fields, one of eight special strings may appear:
string meaning
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".
Enjoy
No comments:
Post a Comment