Beacon Hill, Inc. Technology Solutions

Home > Knowledge Base > Crontab

Crontab

Edit

To edit your crontab enter the following command.


$ crontab -e

If emacs doesn't come up as the editor the following when added to your environment will fix it.


$ export EDITOR=emacs

List

To show what you have setup following an edit.


$ crontab -l

Example

The following comment block is useful to start your crontab with. It shows the positions of each value and what they mean.


# *     *     *     *     *    [user]   command to be executed
# -     -     -     -     -
# |     |     |     |     |
# |     |     |     |     +----- day of week (0 - 6) (Sunday=0)
# |     |     |     +------- month (1 - 12)
# |     |     +--------- day of month (1 - 31)
# |     +----------- hour (0 - 23)
# +------------- min (0 - 59)

Hourly

The following example shows how to run the command 'script.sh' hourly with the results (what the sripts prints to stdio) passed to a log file script.log in foo's logs directory


0	*	*	*	*	script.sh >> /home/foo/logs/script.log

Links