1 / 10

COP 4343 Unix System Administration

COP 4343 Unix System Administration. Unit 8: at cron. Automating Tasks. at, batch execute command in future controlled by atd daemon crontab execute command repeatedly controlled by crond daemon. at. syntax: at time executes commands from standard input file (-f option)

verna
Download Presentation

COP 4343 Unix System Administration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COP 4343Unix System Administration Unit 8: at cron

  2. Automating Tasks • at, batch • execute command in future • controlled by atd daemon • crontab • execute command repeatedly • controlled by crond daemon

  3. at • syntax: at time • executes commands • from standard input • file (-f option) • output arrives via email

  4. at examples • at noon • at now + 5 minutes • at 4pm + 5 days • at noon July 31 • at 10am 10/5/05 • at 3:13am tomorrow

  5. batch • similar to at • command is executed when system load is below 0.8 • output arrives via email

  6. at utilities • directory /var/spool/at • atq • list at jobs • atrm • remove at jobs • control usage: • /etc/at.allow • /etc/at.deny

  7. cron • automate recurring tasks • crond daemon is started in run level • /etc/crontab • /etc/cron.d • /var/spool/cron/username

  8. using crontab • edit /etc/crontab • crontab -e • crontab -u username -e • controlling access • /etc/cron.allow • /etc/cron.deny

  9. crontab file • fields • minute: 00 - 59 • hour: 00 - 23 • day of month: 1 - 31 • month: 1 - 12 • day of week: 0 - 7 (0 is Sunday) • username (only in /etc/crontab file) • command to execute • run-parts /etc/cron.daily

  10. crontab example # use /bin/sh to run commands, no matter what /etc/passwd says SHELL=/bin/sh # mail any output to “paul”, no matter whose crontab this is MAILTO=paul # # run five minutes after midnight, every day 5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1 # run at 2:15pm on the first of every month -- output mailed to paul 15 14 1 * * $HOME/bin/monthly # run at 10 pm on weekdays, annoy Joe 0 22 * * 1-5 mail -s "It’s 10pm" joe%Joe,%%Where are your kids?% 23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday" 5 4 * * sun echo "run at 5 after 4 every sunday"

More Related