Crontab notes

From MIPAV
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Current crontab on build machine

[mccreedy@cake]~% crontab -l
# crontab for mccreedy on cake.cit.nih.gov

# mail output to me:
MAILTO=mccreedy@mail.nih.gov
# use zsh no matter what
SHELL=/bin/zsh

#JAVA_HOME=/home/mccreedy/lib/j2sdk1.4.2_08
#JAVACMD=/home/mccreedy/lib/j2sdk1.4.2_08/bin/java
#JAVA_HOME=/home/mccreedy/lib/jdk1.5.0_06

JAVA_HOME=/home/mccreedy/lib/jdk1.6.0_02
#JAVACMD=/home/mccreedy/lib/jdk1.6.0_02/bin/java

ANT_HOME=/home/mccreedy/bin/apache-ant-1.7.0

#PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

# script directory vars
SCRIPTDIR=/home/mccreedy/bin/scripts
PROJECTDIR=/home/mccreedy/projects

00 23 * * *     $SCRIPTDIR/build/complete-build.zsh -nightly

01 00 * * *     $SCRIPTDIR/build/java_1.5_build.zsh


Crontab notes

  • $MAILTO indicates the address that job output should be emailed to.
  • $SHELL ensures a consistent (zsh) environment for jobs.
  • $JAVA_HOME specifies the default java jdk to use when doing the nightly build (can be overridden by called scripts).
  • $ANT_HOME forces a version of ant which is compatible with java 1.6 (default on bern isn't compatible).
  • $SCRIPTDIR and $PROJECTDIR are machine and user specific.
  • Use 'crontab -l' to print your current crontab. Use 'crontab -e' to make changes using your $EDITOR.

Explanation of crontab job lines

* * * * * <job_command_line>
| | | | |
| | | | +- day of the week (1-7, where 1 => monday)
| | | |
| | | +--- month (1-12)
| | |
| | +----- day of month (1-31)
| |
| +------- hour (0-23)
|
+--------- minute (0-59)
  • An asterisk (*) is used to match any time value for a given scheduling field.
  • Sends email to $MAILTO if the command prints to stdout or stderr.
  • To avoid an email for a command and disregard any output append the following to the command line (zsh/bash):
> /dev/null 2>&1