Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Vixie-cron not running my scheduled job.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
ianw1974
Guru
Guru


Joined: 18 Oct 2006
Posts: 387
Location: UK and Poland

PostPosted: Tue Mar 04, 2008 11:58 am    Post subject: Vixie-cron not running my scheduled job. Reply with quote

I wanted to use the /etc/crontab file for running a job every five minutes. I did this:

Code:
mkdir /etc/cron.fivemins


and put a script in there that I created to update my mrtg, which contains:

Code:
#!/bin/bash
mrtg /etc/mrtg/system.cfg


I made sure it was executable with:

Code:
chmod +x /etc/cron.fivemins/mrtg_update


My /etc/crontab contains:

Code:
# for vixie cron
#
# $Header: /var/cvsroot/gentoo-x86/sys-process/vixie-cron/files/crontab-3.0.1-r4,v 1.1 2005/03/04 23:59:48 ciaranm Exp $
#
#

# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# check scripts in cron.fivemins, cron.hourly, cron.daily, cron.weekly and cron.monthly
*/5 * * * *    root   rm -f /var/spool/cron/lastrun/cron.fivemins
0  *  * * *     root    rm -f /var/spool/cron/lastrun/cron.hourly
1  3  * * *     root    rm -f /var/spool/cron/lastrun/cron.daily
15 4  * * 6     root    rm -f /var/spool/cron/lastrun/cron.weekly
30 5  1 * *     root    rm -f /var/spool/cron/lastrun/cron.monthly
*/10  *  * * *  root    test -x /usr/sbin/run-crons && /usr/sbin/run-crons


so I basically set it up like it would normally be based on the other existing scripts that run fine with this config. I can see in the log file that the job is running every five minutes, but it's not actually doing anything. The logfile shows:

Code:
Mar  4 11:30:01 mail2 cron[16609]: (root) CMD (rm -f /var/spool/cron/lastrun/cron.fivemins)


but wasn't running the script within the directory cron.fivemins. Is there something else I'm missing to get it to run this script? Normally, I just drop stuff in cron.daily or cron.hourly and this is OK. But I wanted to run this script every five mins, and without creating a crontab for a particular user - would rather set it up like I've outlined here.

Any ideas?
_________________
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

Linux Systems Limited | Masternode Monitoring
Back to top
View user's profile Send private message
oliver
Apprentice
Apprentice


Joined: 25 Jun 2003
Posts: 170

PostPosted: Tue Mar 04, 2008 3:12 pm    Post subject: Reply with quote

does /var/log/syslog give any clues?
Back to top
View user's profile Send private message
andreas_st
Tux's lil' helper
Tux's lil' helper


Joined: 26 Dec 2007
Posts: 112
Location: 48N 16E

PostPosted: Tue Mar 04, 2008 3:51 pm    Post subject: Reply with quote

As far as I can see you have not set up anything that would run your cron job. All you are doing is deleting a nonexisting file every five minutes. If you want to do it that way you would have to edit /usr/sbin/run-crons but I really see no advantage compared to a traditional crontab entry.
_________________
Registered Linux user #62727
Back to top
View user's profile Send private message
ianw1974
Guru
Guru


Joined: 18 Oct 2006
Posts: 387
Location: UK and Poland

PostPosted: Tue Mar 04, 2008 7:04 pm    Post subject: Reply with quote

I did add it differently to /etc/crontab this time, and now it's working fine. I was wondering if there was some other file to edit to get it to work, and did wonder about why /etc/crontab was set up like this. But kinda makes sense now :)
_________________
Ian Walker

Light travels faster than sound. This is why some people appear bright until you hear them speak.........

Linux Systems Limited | Masternode Monitoring
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum