DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 4th August 2008
beandip beandip is offline
Port Guard
 
Join Date: Jul 2008
Posts: 14
Default Crontab not working

I am running FreeBSD 6.3 STABLE.

Everything seems to running fine however a while back my cacti scripts stopped working. I just now have had time to look into it and it appears that nothing that I have in my /etc/crontab is executing.
Code:
# ps aux|grep cron
root       1575  0.0  0.1  4720  1380  ??  Is    9:23AM   0:00.07 /usr/sbin/cron -s
root      10357  0.0  0.0   452   364  p0  R+    2:31PM   0:00.00 grep cron
I am not sure where to troubleshoot next. Any advice?

my crontab file has this
Code:
# /etc/crontab - root's crontab for FreeBSD
#
# $FreeBSD: src/etc/crontab,v 1.32 2002/11/22 16:13:39 tom Exp $
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour    mday    month   wday    who     command
#
*/5     *       *       *       *       root    /usr/libexec/atrun
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11    *       *       *       *       operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
0       *       *       *       *       root    newsyslog
#
# Perform daily/weekly/monthly maintenance.
1       3       *       *       *       root    periodic daily
15      4       *       *       6       root    periodic weekly
30      5       1       *       *       root    periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time.  See adjkerntz(8) for details.
1,31    0-5     *       *       *       root    adjkerntz -a
*/5     *       *       *       *       cactiuser       /usr/local/bin/php /usr/local/share/cacti/poller.php > /usr/local/share/cacti/log/poller.log 2>&1
02      0       *       *       *       root    /usr/local/etc/awstats/cgi-bin/awstats.pl -update -config=my.intranet.com
*/10    *       *       *       *       root    /usr/local/bin/php /root/cronzweather /usr/local/www/html/joomla
*/5     *       *       *       *       root    /usr/local/libexec/nagios/nagios_stats.pl > /dev/null 2>&1
*/45    *       *       *       *       root    /usr/local/bin/php -f /usr/local/www/html/joomla/components/com_gallery2/cron/g2CronJob.php

Last edited by beandip; 4th August 2008 at 08:37 PM.
Reply With Quote
  #2   (View Single Post)  
Old 4th August 2008
graudeejs's Avatar
graudeejs graudeejs is offline
Real Name: Aldis Berjoza
ISO Quartermaster
 
Join Date: Jul 2008
Location: Riga, Latvia
Posts: 589
Default

Is it what you have when you crontab -l ?
If so remove user (root etc.)
I had something similar

Code:
#minute hour    mday    month   wday    command
#
*/5     *       *       *       *       /usr/libexec/atrun
....
(Backup original fail, in case i'm wrong)
Reply With Quote
  #3   (View Single Post)  
Old 4th August 2008
jbhappy's Avatar
jbhappy jbhappy is offline
Real Name: Jeff
Port Guard
 
Join Date: Jun 2008
Location: MI, US
Posts: 30
Default

Quote:
Originally Posted by beandip View Post
I am running FreeBSD 6.3 STABLE.

Everything seems to running fine however a while back my cacti scripts stopped working. I just now have had time to look into it and it appears that nothing that I have in my /etc/crontab is executing.
I am not sure where to troubleshoot next. Any advice?
try
# tail /var/log/cron

what's the latest timestamp? any interesting errors in the file?
Reply With Quote
  #4   (View Single Post)  
Old 4th August 2008
beandip beandip is offline
Port Guard
 
Join Date: Jul 2008
Posts: 14
Default

Code:
# crontab -l
crontab: no crontab for root


according to the tail command it looks like it is executing.

Code:
# tail /var/log/cron
Aug  4 15:05:00 team /usr/sbin/cron[16731]: (cactiuser) CMD (      /usr/local/bin/php /usr/local/share/cacti/poller.php > /usr/local/share/cacti/log/poller.log 2>&1)
Aug  4 15:05:00 team /usr/sbin/cron[16732]: (root) CMD (/usr/libexec/atrun)
Aug  4 15:10:00 team /usr/sbin/cron[16863]: (root) CMD (/usr/local/libexec/nagios/nagios_stats.pl > /dev/null 2>&1)
Aug  4 15:10:00 team /usr/sbin/cron[16864]: (root) CMD (/usr/local/bin/php /root/cronzweather /usr/local/www/html/joomla)
Aug  4 15:10:00 team /usr/sbin/cron[16865]: (cactiuser) CMD (      /usr/local/bin/php /usr/local/share/cacti/poller.php > /usr/local/share/cacti/log/poller.log 2>&1)
Aug  4 15:10:00 team /usr/sbin/cron[16866]: (root) CMD (/usr/libexec/atrun)
Aug  4 15:11:00 team /usr/sbin/cron[16996]: (operator) CMD (/usr/libexec/save-entropy)
Aug  4 15:15:00 team /usr/sbin/cron[17011]: (root) CMD (/usr/local/libexec/nagios/nagios_stats.pl > /dev/null 2>&1)
Aug  4 15:15:00 team /usr/sbin/cron[17012]: (cactiuser) CMD (      /usr/local/bin/php /usr/local/share/cacti/poller.php > /usr/local/share/cacti/log/poller.log 2>&1)
Aug  4 15:15:00 team /usr/sbin/cron[17013]: (root) CMD (/usr/libexec/atrun)
Reply With Quote
  #5   (View Single Post)  
Old 4th August 2008
jbhappy's Avatar
jbhappy jbhappy is offline
Real Name: Jeff
Port Guard
 
Join Date: Jun 2008
Location: MI, US
Posts: 30
Default

Quote:
Originally Posted by beandip View Post
Code:
# crontab -l
crontab: no crontab for root
yeah, cron is just getting everything from /etc/crontab. that's a normal place for system jobs on systems that use /etc/crontab, so don't sweat it. your crontab file is in the right format.

Quote:
according to the tail command it looks like it is executing.
indeed. so your cacti log file appears to be /usr/local/share/cacti/log/poller.log, according to your cron entry. is anything new showing up in there?
Reply With Quote
  #6   (View Single Post)  
Old 5th August 2008
beandip beandip is offline
Port Guard
 
Join Date: Jul 2008
Posts: 14
Default

Crontab is working. I had multiple problems that are tied to it that made it look like it was not working.

While troubleshooting I discovered a problem with one of Cacti's MySQL tables. I had to execute a truncate command to fix it and now cacti is working properly again.

Thanks for your help. I did not know about the tail command but I see how it can be useful in the future.
Reply With Quote
  #7   (View Single Post)  
Old 6th August 2008
phoenix's Avatar
phoenix phoenix is offline
Risen from the ashes
 
Join Date: May 2008
Posts: 696
Default

Quote:
Originally Posted by killasmurf View Post
Is it what you have when you crontab -l ?
If so remove user (root etc.)
I had something similar
/etc/crontab is very different from user crontabs.

crontab -l checks the user crontab, which doesn't need the user column.

/etc/crontab is the system crontab, and needs to know which user to run each command as.
__________________
Freddie

Help for FreeBSD: Handbook, FAQ, man pages, mailing lists.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Working with CVS? Zmyrgel OpenBSD General 15 6th October 2009 01:32 PM
[ OpenBSD 4.5 ] apm -C not working wraith0x2b OpenBSD Installation and Upgrading 17 6th May 2009 09:03 AM
Crontab won't run script Petrocelli08 FreeBSD General 4 7th March 2009 04:19 AM
x11 forwarding over ssh not working kasse OpenBSD General 14 23rd December 2008 02:21 PM
pf: why is that rule not working? ivanatora FreeBSD General 14 11th December 2008 09:32 AM


All times are GMT. The time now is 07:20 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick