Cron, Anacron, at Cron

Cron, Anacron, at Cron

Scheduling Jobs: cron, anacron, at cron jboydt :: csci 26 | cron, anacron, at What is cron? ● a daemon ● a job scheduler ● a way to run both: ○ system cron jobs ■ run as root, for system-wide maintenance ○ user cron jobs ■ run as a specified user jboydt :: csci 26 | cron, anacron, at How do I use cron? ● /etc/crontab (system cron jobs) ● crontab (utility, user cron jobs) ○ crontab -u USER -l (list current crontab for USER) ○ crontab -u USER -e (edit current crontab for USER) ○ crontab -u USER -r (remove current crontab for USER) jboydt :: csci 26 | cron, anacron, at What does a cron entry look like? jboydt :: csci 26 | cron, anacron, at What does a cron entry look like? ● 7 fields minute hour day month day-of-week user command (0-59) (0-23) (1-31) (1-12)* (0-7) ● month and day-of-week can be specified using first three letters (e.g., Dec, Wed) ● 0 and 7 for day-of-week are both Sunday ● an asterisk (*) in a field means all available (e.g., a * for day field means every day) ● use a dash (-) to specifiy a range (e.g., 1-6 for month means January through February) ● use a slash (/) to specify increments (e.g., */15 for minutes means every 15 minutes) ● use commas to specify multiple values (e.g., 1,3,5 for day-of-week means Mon, Wed, Fri) jboydt :: csci 26 | cron, anacron, at What does a cron entry look like? ● some examples 0 12 * * * root SOME_SCRIPT (midnight every day) */30 * * * 1,3,5 janedoe SOME_SCRIPT >> /home/janedoe/LOGFILE (every 30 minutes on Mon, Wed, Fri) 0 0 1 * * root SOME_SCRIPT (midnight on the first day of every month) * note that a cron job should not require user inputs, and output statements do not work jboydt :: csci 26 | cron, anacron, at anacron jboydt :: csci 26 | cron, anacron, at What is anacron? ● a daemon ● a supplement to cron ○ good for systems that are not necessarily “always on” (cron handles those systems) ● a job scheduler ○ day, week, or month only (not by the minute or hour like cron) ○ tracks “past due” jobs and runs them jboydt :: csci 26 | cron, anacron, at +/- of anacron ● only administrator can schedule ● may end up running several “past due” jobs shortly after booting ○ the jobs are run sequentially (one after another) ○ may cause a system to be less responsive ● can only run a job once a day at most ● /etc/anacrontab ○ format is different from /etc/crontab jboydt :: csci 26 | cron, anacron, at at jboydt :: csci 26 | cron, anacron, at What is at? ● a daemon ● a “one-time” job scheduler ● examples * schedule non-interactively echo “cp IMPORTANT_FILE IMPORTANT_FILE.backup” | at 1200 apr 1 * schedule interactively at 2359 apr 1 at> who >> /home/janedoe/whowason at> CTRL-D jboydt :: csci 26 | cron, anacron, at jboydt :: csci 26 | cron, anacron, at .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us