| /| /
|/ |/iki                                 Map  About  |  Page  New  Edit  History

Cron
________________________________________________________________________________

This will be particularly about 'dcron' with Void Linux (i.e runit).

[000] Index
________________________________________________________________________________

* Jobs ................................................................... [001]
* Examples ............................................................... [002]
* Commandline ............................................................ [003]

[001] Jobs
________________________________________________________________________________

Syntax for declaring a job is:

 %M %H %d %m %a command

Where '%?' is 'date +format' specifiers ('%M' is minute, etc).

Cron follows certain specifications,
- '*'             - is a wildcard which makes specifier be ignored.
- '[0-9]+'        - instead of * will make cron run at specified time.
- '[0-9]+,[0-9]+' - will execute job at multiple specified times.
- '[0-9]+-[0-9]+' - will limit execution between certain time.
- '*/[0-9]+'      - will run every N time period.
- '@hourly', '@daily'/'@midnight', '@weekly', '@monthly' and '@reboot' are
    shorthands, with hourly being '0 * * * *'.

Command can be anything that shell can execute.

You can access '$HOME', '$USER'/'$LOGNAME', '$SHELL' and '$PATH' environment
    variables which makes it possible to '. $HOME/.bashrc; $HOME/script.sh'

[002] Examples
________________________________________________________________________________

> TODO: examples

Verify environment:

 * * * * printenv > ~/cron_env_test.txt

[003] Commandline
________________________________________________________________________________

- list jobs         - crontab -l
- edit job file     - crontab -e
- remove all jobs   - crontab -r
- replace with file - crontab [filename]
- insert from stdin - crontab -

________________________________________________________________________________

Alisa Lain (C) 2025-2026