Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "1 COP 4343 Unix System Administration Unit 8: – at – cron."— Presentation transcript:

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

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

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

4 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 5 batch similar to at command is executed when system load is below 0.8 output arrives via email

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

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

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

9 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 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"


Download ppt "1 COP 4343 Unix System Administration Unit 8: – at – cron."

Similar presentations


Ads by Google