Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:schedule_tasks_using_at_and_cron [2016/02/29 21:44] billdozor created |
linux_wiki:schedule_tasks_using_at_and_cron [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
**General Information** | **General Information** | ||
- | About this page/how-to/script. | + | Using system utilities |
---- | ---- | ||
- | ==== at ==== | + | ===== at ===== |
at is good for one-off jobs that don't need to reoccur regularly. | at is good for one-off jobs that don't need to reoccur regularly. | ||
+ | \\ | ||
Install, Enable, Start | Install, Enable, Start | ||
<code bash> | <code bash> | ||
Line 17: | Line 19: | ||
</ | </ | ||
+ | \\ | ||
Example Times (teatime is 4pm) | Example Times (teatime is 4pm) | ||
<code bash> | <code bash> | ||
Line 26: | Line 29: | ||
</ | </ | ||
+ | \\ | ||
Example job | Example job | ||
<code bash> | <code bash> | ||
Line 33: | Line 37: | ||
</ | </ | ||
+ | \\ | ||
View jobs | View jobs | ||
<code bash> | <code bash> | ||
Line 38: | Line 43: | ||
</ | </ | ||
+ | \\ | ||
Remove job (cancel job) | Remove job (cancel job) | ||
<code bash> | <code bash> | ||
Line 45: | Line 51: | ||
---- | ---- | ||
- | ==== cron ==== | + | ===== cron ===== |
cron is for scheduling reoccurring jobs/ | cron is for scheduling reoccurring jobs/ | ||
+ | \\ | ||
Edit current user's cron | Edit current user's cron | ||
<code bash> | <code bash> | ||
Line 54: | Line 61: | ||
</ | </ | ||
+ | \\ | ||
System wide | System wide | ||
<code bash> | <code bash> | ||
Line 67: | Line 75: | ||
</ | </ | ||
+ | \\ | ||
More preferred method: Place scripts inside one of the cron.* directories. | More preferred method: Place scripts inside one of the cron.* directories. | ||
* / | * / | ||
Line 74: | Line 83: | ||
* / | * / | ||
+ | \\ | ||
Example custom script in /etc/cron.d | Example custom script in /etc/cron.d | ||
<code bash> | <code bash> | ||
Line 79: | Line 89: | ||
</ | </ | ||
* Executes / | * Executes / | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Anacron ===== | ||
+ | |||
+ | Anacron runs all scripts in cron.* directories. This allows jobs to be run if the scheduled time was while a system was powered off. | ||
+ | |||
+ | \\ | ||
+ | Main config and contents: / | ||
+ | <code bash> | ||
+ | #period in days delay in minutes | ||
+ | 1 5 cron.daily nice run-parts / | ||
+ | 7 25 cron.weekly nice run-parts / | ||
+ | @monthly 45 cron.monthly nice run-parts / | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | Run all anacron jobs(in / | ||
+ | <code bash> | ||
+ | anacron -f | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | View timestamps for anacron jobs (cron.daily in this example) | ||
+ | <code bash> | ||
+ | cat / | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | Run all jobs now, ignore delay specifications in / | ||
+ | <code bash> | ||
+ | anacron -n | ||
+ | </ | ||
---- | ---- | ||