LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 05-02-2007, 03:04 PM   #1
JROCK1980
Member
 
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
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
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
x_terminat_or_3
Member
 
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.

Try

Code:
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

Code:
* * * * * 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
WantLinuxHelp
Member
 
Registered: Jan 2009
Posts: 68
Blog Entries: 1

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


Code:
* * * * * 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
tgs78
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.

http://www.thegeekscope.com/linux-cron-job-scheduler/

Hope you will find this post useful !
 
  


Reply



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

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 01:41 AM.

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