some cron jobs not "firing"
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.
–Ray
9 Replies
#!/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).
@hernan43:
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:
root# man crontab
root# man 5 crontab (ok, works on Gentoo, maybe not on Debian)
root# crontab -e
–Ray
@hernan43:
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.
–Ray
# run-parts --test /etc/cron.daily
# run-parts --verbose /etc/cron.daily
Or is that what you tested?
epylog
--Ray
@hernan43:
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.
rc-update show
and looking for vixie-cron.