Cron jobs testing 

From http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/custom-guide/cron-task.html

,-----
| The cron daemon checks the etc/crontab file, the etc/cron.d/
| directory, and the /var/spool/cron directory every minute for any
| changes. If any changes are found, they are loaded into
| memory. Thus, the daemon does not need to be restarted if a crontab
| file is changed.
`-----

Here is an example showing how add an entry to etc/cron.d/ using symlinks.

create a file /path/to/sysbak.cron:

# one minute interval testing
* * * * * root /path/to/sysbak.sh test

and in /path/to/sysbak.sh:

MAILTO=tong
echo "Unknown option passed to $0: '$1'"

Then created a symlink:

ln -sf /path/to/sysbak.cron /etc/cron.d/

That's it. Watch the syslog with

tail /var/log/syslog

Then check the email.

Cron jobs testing 

Newsgroups: comp.os.linux.misc,comp.os.linux.admin,linux.redhat.misc Date: Tue, 25 Feb 2003 19:25:10 GMT

Support for crontabs under /etc/cron.d is flaky at best, often being undocumented and/or broken.

Robert Tinsley

Cron jobs testing 

>> I added an entry to etc/cron.d/ but why it doesn't get executed?
>
> You shouldn't do that. You should run "crontab -e" as the user who is
> going to execute the scheduled task.

Does crontab -e diddle the /etc/crontab file though? I always edit that one myself with emacs. I am not pushing emacs here: use whatever text editor you like. (I seldom need to edit /etc/crontab except when installing a new release or something.)

Jean-David Beyer

Cron jobs testing 

> you shouldn't edit /etc/crontab at all. that file is just an evil, nasty
> hack put in by red hat so that they could implement /etc/cron.daily (and
> friends) in some totally non-standard way.

SuSE is using /etc/crontab too. I like it, if you have multiple cron jobs running as different app user, it's more pleasant (for me) to have them in a single file.

Michael Heiming