I tried to schedule my first cron job as follows:

crontab -e

The file had some comments at the top, and on the first line after those, I put

* * * * * date

I expected the date and time to be printed out every minute, but nothing happens on the terminal. Is the output getting sent elsewhere, or is the cron job not running? Any tips to make this work?


From the cron man page:

When executing commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists). The children copies of cron running these processes have their name coerced to uppercase, as will be seen in the syslog and ps output.

So I would check your email if you have it setup with the system, or the syslog (eg. /var/log/syslog).

EDIT From serverfault(edited to match your command)

The following will send any Cron output to /usr/bin/logger (including stderr, which is converted to stdout using 2>&1), which will send to syslog, with a 'tag' of date_logging. Syslog handles it from there. Since most systems already have built-in log rotation mechanisms, I don't need to worry about a log like /var/log/mycustom.log filling up a disk.

* * * * * root    /bin/date 2>&1 | /usr/bin/logger -t date_logging
  • Should this therefore be printing the output to the terminal? I tried entering in the cron job exactly as shown, but am not getting anything on the terminal (which should happen each minute, right?). – John Mar 17 '15 at 5:39
  • The answer helped me understand that I needed to redirect the output, though, which was a light bulb! – John Mar 17 '15 at 5:40
  • no, it will be sent to /var/log/syslog. try issuing cat /var/log/syslog | grep date_logging – Dylan Mar 17 '15 at 5:41
  • I changed the command to * * * * * date 2>&1 | /usr/bin/logger -t date_logging, as I saw some errors in the log due to the "root" user. I think my root user is called pi(?). Thanks for the help! – John Mar 17 '15 at 5:48
  • Glad it worked for ya! – Dylan Mar 17 '15 at 5:50

OP, at the top of my crontab, just before any jobs, I have these comments to remind me of the cron format, followed by the MAILTO variable setting. As good practice, all cron variables should be set before any cron job definitions.

# min  hrs  dayofmonth  month  dayofweek  command
# dow = 0-6 where 0 is Sunday, 6=Saturday

So in my case, chuck is a user local to the machine cron is running on. If you have a full Mail Transfer Agent set up, you can set MAILTO to a full email address:


All cron output is sent to the user in the MAILTO variable.

Be careful, as I have gotten "blank" emails from cron which weren't really blank. It captured a carriage return output to STDOUT! That was a PITA to track down as I could not find a way for my Ubuntu mail reader (alpine) to show hidden characters. (It's a good idea to have a mail reader that shows hidden ctrs.)

As an alternative to test a job batch/shell file, you can use at. Enter at TIMESPEC followed by one command per line, then ^D at the end of the command list. However this will not let you know if your cron variables are set up correctly, but you will still get an email (to the current local user that ran the at job) when the at job is complete.

at now + 1 minute<ENTER>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.