Review your favorite Linux distribution.
Go Back > Forums > Other *NIX Forums > *BSD
User Name
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.


  Search this Thread
Old 05-02-2007, 03:04 PM   #1
Registered: Aug 2003
Distribution: FreeBSD
Posts: 490

Rep: Reputation: 30
crontab test

How can I test my crontab? Is there a command I can run to test it?
Old 05-02-2007, 03:42 PM   #2
ReliaFree Maintainer
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,812
Blog Entries: 1

Rep: Reputation: 259Reputation: 259Reputation: 259
What kind of test? Here's some things I do...
  • Is cron running? ---> Run ps ax | grep cron and make sure it shows up!
  • Is cron working? ---> Try: * * * * * /bin/echo "foobar" >> /file_you_own and make sure it works.
  • Is your command working? ---> Try: * * * * * /bin/foobar > /file_you_own 2>&1 and look for errors in /file_you_own
  • Can cron run your job? ---> Check the cron log, usually /var/log/cron.log or /var/log/messages for errors
Old 05-02-2007, 03:43 PM   #3
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
It is very easy. All you have to do is think logically

1st place to look is in the logs.

On Redhat, and variants, the file to examine is /var/log/cron I am not sure about its whereabouts on Debian, but I'd suspect it's pretty much the same.


tail /var/log/cron
To see the last few lines of that file.

That file is basically a list with the times and commands that cron executed.

Another option would be to add a line to your crontab like this

* * * * * wall test
If your cron works, then after two minutes, you will see the word test appear on your console every minute
Old 12-01-2011, 12:37 PM   #4
Registered: Jan 2009
Posts: 68
Blog Entries: 1

Rep: Reputation: 15
For me under Ubuntu 11.04, "wall test" failed. This worked, though

* * * * * echo "Cron Worked $(date)" >> /tmp/cronworked.txt
And then look for tile /tmp/cronworked.txt

Under Ubuntu, if it did NOT work, errors are in /var/log/syslog
Old 09-24-2012, 02:35 PM   #5
LQ Newbie
Registered: Aug 2012
Posts: 6

Rep: Reputation: 0
Linux cron job scheduling

An article explaining the Linux cronjob scheduling with the help of examples.

Hope you will find this post useful !


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Mozilla invites users to pre-test a test LXer Syndicated Linux News 0 08-09-2006 11:12 PM
about crontab shipon_97 Linux - General 1 02-28-2006 05:22 AM
FC4 Test 1 CD Test failes every DISC Jimbo99 Linux - Software 1 03-18-2005 03:16 PM
crontab fedora 3 test 2 james.farrow Fedora 2 10-10-2004 02:46 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 04:14 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration