Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Aug 05, 2004 8:39 am 
Offline
Senior Newbie

Joined: Fri Jul 23, 2004 2:19 pm
Posts: 6
WLM: bncngsoul@hotmail.com
Yahoo Messenger: hernandezrf
AOL: CovertNinja2000
I have a linode64 running debian unstable. I added a script to cron.hourly and another script to cron.daily. The cron.hourly one doesn't run at all. Neither does the cron.daily job, but the rest of the scripts in cron.daily do run like normal. I tried restarting cron, but that didn't seem to have any effect. I searched the forums for my particular problem and I couldn't seem to find anything remotely close to what I was experiencing.

I am pretty new to debian and I am not sure which type of cron they are running. I have no doubt that I am doing something wrong. I am hoping that someone here has some glimpse of hope for me. :) Anyway, I am used to just dropping scripts in these directories and having them run. So if anyone can throw me a bone, I would be most appreciative. Thanks in advance.
--Ray


Top
   
 Post subject:
PostPosted: Thu Aug 05, 2004 10:00 am 
Offline
Senior Member
User avatar

Joined: Fri Aug 15, 2003 2:15 pm
Posts: 111
Website: http://fubegra.net/
Make sure your scripts have execute permission, and also that they have something like:

Code:
#!/bin/bash


as the first line of the script (this of course assumes you're using a bash script - if it's perl, that should be #!/usr/bin/perl instead).

_________________
Bus error (passengers dumped)


Top
   
PostPosted: Thu Aug 05, 2004 4:45 pm 
Offline
Junior Member

Joined: Wed Jul 21, 2004 4:45 am
Posts: 21
Website: http://www.percederberg.net
Location: Stockholm, Sweden
hernan43 wrote:
Anyway, I am used to just dropping scripts in these directories and having them run.

Well... As far as I've heard it is discouraged to add and tamper with the files in these directories unless you really know what you are doing. Supposedly the Debian package manager may do things here from time to time, as these are the system (not user) cron jobs.

Instead, crontab is your friend and will happily come to your rescue:
Code:
root# man crontab
root# man 5 crontab       (ok, works on Gentoo, maybe not on Debian)
root# crontab -e


Top
   
 Post subject:
PostPosted: Fri Aug 06, 2004 11:05 am 
Offline
Senior Newbie

Joined: Fri Jul 23, 2004 2:19 pm
Posts: 6
WLM: bncngsoul@hotmail.com
Yahoo Messenger: hernandezrf
AOL: CovertNinja2000
As far as I know, it is perfectly acceptable to add my own scripts to these directories. These scripts have nothing to do with the debian package stuff so they should be ok. They are executable and they just flat out don't run. I have done this countless times. I am boggled as to what I am doing wrong. I'll just keep hitting google.
--Ray


Top
   
 Post subject:
PostPosted: Fri Aug 06, 2004 2:20 pm 
Offline
Junior Member

Joined: Wed Jul 21, 2004 4:45 am
Posts: 21
Website: http://www.percederberg.net
Location: Stockholm, Sweden
hernan43 wrote:
As far as I know, it is perfectly acceptable to add my own scripts to these directories. These scripts have nothing to do with the debian package stuff so they should be ok.

Just checked this up a bit more. Seems all the files in /etc/cron.* are run by the system /etc/crontab on the times specified therein. They are executed by /bin/run-parts (at least on the Debian box I just checked).

Idea: Why not try to execute that program manually as root to see what happens? Do check "man run-parts" and "more /etc/crontab" first though, to make sure nothing explodes and to get the right command-line switches.


Top
   
 Post subject:
PostPosted: Sat Aug 07, 2004 8:47 am 
Offline
Senior Newbie

Joined: Fri Jul 23, 2004 2:19 pm
Posts: 6
WLM: bncngsoul@hotmail.com
Yahoo Messenger: hernandezrf
AOL: CovertNinja2000
I can execute it fine by hand from the cron directory. The weird thing is, every script in that directory executes except the one. It has the same permissions as all of the other scripts. I even restarted cron a bunch of times. I know I am doing something wrong, I just have to nail down what it is ;).
--Ray


Top
   
 Post subject:
PostPosted: Sat Aug 07, 2004 3:10 pm 
Offline
Junior Member

Joined: Wed Jul 21, 2004 4:45 am
Posts: 21
Website: http://www.percederberg.net
Location: Stockholm, Sweden
Yeah, but I meant:
Code:
# run-parts --test /etc/cron.daily
# run-parts --verbose /etc/cron.daily

Or is that what you tested?


Top
   
 Post subject:
PostPosted: Sat Aug 07, 2004 4:59 pm 
Offline
Senior Newbie

Joined: Fri Jul 23, 2004 2:19 pm
Posts: 6
WLM: bncngsoul@hotmail.com
Yahoo Messenger: hernandezrf
AOL: CovertNinja2000
Well, a couple of things. When I did the man run-parts(which I hadn't done before) I noticed that there were certain naming conventions that your script had to abide by. My script was named epylog.cron, and I changed it to just read as epylog. Then I restarted cron, and then I ran the run-parts --test. This time it showed my script in the list of things to run. Tomorrow, I will know for certain, but it looks like I just had to re-name my script. My thanks to cederberg as I had not thought to look into run-parts specifically until he had mentioned it. Thanks again.
--Ray


Top
   
 Post subject:
PostPosted: Wed Aug 25, 2004 6:50 pm 
Offline
Senior Member

Joined: Sun Nov 30, 2003 2:28 pm
Posts: 245
hernan43 wrote:
As far as I know, it is perfectly acceptable to add my own scripts to these directories. These scripts have nothing to do with the debian package stuff so they should be ok.


The problem is that your scripts may be overwritten by a new package installation if you happen to get unlucky in your naming. Prefixing your scripts with local_ is probably a good bet. The robust way to do it is to switch on LSB compliant naming (man run-parts) and follow the rules for local names.

I do, however, tend to discourage people from using the Debian cron.* directories for local stuff. Those directories were setup so that packages would have a way to use cron without having to modify /etc/crontab and possibly lose local sysadmin edits. Therefore, the canonical Debian Way is for the local admin to use /etc/crontab.

BTW, I don't mind people submitting questions about Debian cron via the Debian BTS. It helps me identify weak points in the man pages.

_________________
The irony is that Bill Gates claims to be making a stable operating system and Linus Torvalds claims to be trying to take over the world.
-- seen on the net


Top
   
PostPosted: Fri Oct 01, 2004 1:21 pm 
Offline
Senior Newbie

Joined: Fri Oct 01, 2004 12:44 pm
Posts: 7
On my gentoo I woud check this by running
Code:
rc-update show
and looking for vixie-cron.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 7 guests


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

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group