Tasks automatisation: the cron daemon: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
 
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
== crontab editing ==
= General help and syntax =
 
* man crontab gives you useful examples. Be careful that the first number represents the minutes NOT the hours.
 
= Crontab Editing =


* You should not edit by hand /etc/crontab. This system wide file may not even exist (on Gentoo it does not exist for example). Instead use
* You should not edit by hand /etc/crontab. This system wide file may not even exist (on Gentoo it does not exist for example). Instead use


  crontab -e u ''username''
  crontab -e -u ''username''


This will edit the user crontab, and ensure that changes are notified to the crond daemon.
This will edit the user crontab, and ensure that changes are notified to the crond daemon.
= Crontab Debugging =
* When debugging crontab scripts, *make sure* that the script runs OK first. Run it as it would be loaded from the crontab daemon, and verify that no problems occur.
= Notes =
* Some outdated articles on the Net do no longer apply to recent versions of OS X. In particular, there is no additional column in the crontab for the user under which the command is to be ran. The format is basically the same as in Linux.

Latest revision as of 19:56, 20 May 2010

General help and syntax

  • man crontab gives you useful examples. Be careful that the first number represents the minutes NOT the hours.

Crontab Editing

  • You should not edit by hand /etc/crontab. This system wide file may not even exist (on Gentoo it does not exist for example). Instead use
crontab -e -u username

This will edit the user crontab, and ensure that changes are notified to the crond daemon.

Crontab Debugging

  • When debugging crontab scripts, *make sure* that the script runs OK first. Run it as it would be loaded from the crontab daemon, and verify that no problems occur.

Notes

  • Some outdated articles on the Net do no longer apply to recent versions of OS X. In particular, there is no additional column in the crontab for the user under which the command is to be ran. The format is basically the same as in Linux.