Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to know how I can check to see if my cronjob will run at the specified time I set it at. Is there anyway I can test this without having to wait for that time?

Here are my crontab -l results:

root@work:~$ crontab -l
3 */23 * * * /opt/lampp/bin/php /opt/lampp/htdocs/site/cron/my_script.php > /dev/null

If I did the values right, will my cronjob run at exactly 11pm every night and log any output to /dev/null for cleanliness?


share|improve this question
Great question. Additionally, I would like to know if it's possible to get a report of Cron on what actions it will perform doing for the next [defined] period of time. – gertvdijk Sep 18 '12 at 21:53
up vote 6 down vote accepted

The only way to be sure is to let it run and inspect the results. You can modify your command to log the output somewhere and inspect that, or let it email you the output.

You could add another identical line which runs the command within 5 minutes or so, for debugging. eg. If it's 3:13 pm right now, I might add this line to test the command after 3 minutes from now:

# Run at 15:16
16 15 * * * /opt/lampp/bin/php /opt/lampp/htdocs/site/cron/my_script.php > /dev/null

BTW. To run at 11 PM every night, you probably want this instead; I have also redirected stderr to stdout (2>&1) to ensure that all output goes to /dev/null:

# At minute 0 of hour 23 on every day, every month, every day of the week:
0 23 * * * /opt/lampp/bin/php /opt/lampp/htdocs/site/cron/my_script.php > /dev/null 2>&1
share|improve this answer
Thank you for the great answer. Thanks to everyone else in this question for the helpful and positive comments/answers! – user1062058 Sep 18 '12 at 23:48

I guess the simplest option is to set your cron job at an earlier time, say 5 minutes from now and see if the job worked. Additionally it is good form to have your cron run log into a dated file. That way you can see #1 that it did run, and #2 it ran correctly.

Make sure your system time is correct as well.

share|improve this answer

As an addition to the other good answers, you can sanity check cron settings with online test pages:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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