The sixth field of a line in a crontab file is a string that is executed by the shell at the specified times. A percent character in this field (unless escaped by \) is translated to a NEWLINE character.
Only the first line (up to a `%' or end of line) of the command field is executed by the shell. Other lines are made available to the command as standard input. Any blank line or line beginning with a `#' is a comment and is ignored.
date
command, as shown below:
01 07 * * * crontab -l > /home/user/cron.`date +\%Y\%m\%d`Also note, that cron isn't clever enough to expand the tilde (~) character, so always use the full path to your home directory. If you find that a cron hasn't fired, check your email in /var/mail/user.
cron accepts $HOME, too
ReplyDelete