Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sys Admin Course Job Scheduling Fourie Joubert. Sys Admin Course Very often, you may want a job to run once at a certain time, or to run regularly at.

Similar presentations


Presentation on theme: "Sys Admin Course Job Scheduling Fourie Joubert. Sys Admin Course Very often, you may want a job to run once at a certain time, or to run regularly at."— Presentation transcript:

1 Sys Admin Course Job Scheduling Fourie Joubert

2 Sys Admin Course Very often, you may want a job to run once at a certain time, or to run regularly at a certain time Linux has different ways for these scenarios

3 Sys Admin Course at at is designed to run a job once, at a certain time Activating the at service service atd start chkconfig atd on

4 Sys Admin Course Using at at TIME Time specification – HH:MM – midnight – noon – teatime – MONTHDAYYEAR – MMDDYY, MM/DD/YY, or MM.DD.YY – now + TIME

5 Sys Admin Course When you have the > at prompt, provide the commands Once finished, use Ctrl-D in an empty line to exit To view the jobs scheduled by at atq To remove jobs scheduled by at atrm job_number

6 Sys Admin Course Some examples at 4pm + 3 days at 10am Jul 31 At 1am tomorrow

7 Sys Admin Course batch batch will run a job once the system load drops below 0.8 To start your definition batch You will get the > at prompt Enter the command you want to run Once finished, use Ctrl-D in an empty line to exit

8 Sys Admin Course Additional flags Read command from a file rather than type them -f filename Send an e-mail when completed -m email_address

9 Sys Admin Course Controlling access to at and batch – /etc/at.allow – /etc/at.deny

10 Sys Admin Course cron cron runs jobs regularly according to a schedule anacron remembers the scheduled jobs if the system is not running at the time when the job is scheduled. The job is then executed as soon as the system is up. However, Anacron can only run a job once a day

11 Sys Admin Course minute: 0 – 59 hour: 0 – 23 day: 1 – 31 month: 1 – 12 day of week: 0 – 7 (Sunday is 0 or 7) or sun

12 Sys Admin Course * means all values - is a range, eg. 3-4 A list may be comma-separated, eg. 1,2,3 Normal users may also set up cron jobs Access to cron is determined by /etc/cron.allow and /etc/cron.deny

13 Sys Admin Course Editing the crontab export EDITOR=nano crontab –e Viewing the crontab crontab –l

14 Sys Admin Course This will run every minute all the time * * * * * [command] This will run at minute zero every hour 0 * * * * [command] This will run 15 mins past every hour 15 * * * * [command] This will run once a day at 2:30 am 30 2 * * * [command] This will run once a month, on the second day of the month at midnight 0 0 2 * * [command]

15 Sys Admin Course This will run on Mondays every hour 0 * * * 1 [command] This will run three times every hour at minutes 0, 10 and 20 0,10,20 * * * * [command] This will run 12 times every hour, thus every 5 mins */5 * * * * [command] This will run once every hour, between 5:00 am and 10:00 am 0 5-10 * * * [command]

16 Sys Admin Course There is a special command, that will run every time the server is rebooted @reboot [command]


Download ppt "Sys Admin Course Job Scheduling Fourie Joubert. Sys Admin Course Very often, you may want a job to run once at a certain time, or to run regularly at."

Similar presentations


Ads by Google