fcron

Durk van Veen nospamplz at example.com
Wed Nov 17 09:42:46 PST 2004


I'm running fcron in a way similar to how RedHat sets up their cron. In the
crontab I just have 4 jobs (for hourly, daily, weekly and monthly) each of
which is simply running a script called "run-parts" that walks through a
folder and executes each of the scripts in it (fcron.hourly, fcron.daily,
etc). When you compile this crontab it just compiles in the run-parts calls,
but not what each of the run-parts scripts actually ends up calling when
they are invoked. This way you can modify the actual stuff that fcron ends
up running without having to ever recompile the script. I wonder if that
would solve your problem as well, since if fcron does in fact check whether
the things it spun up on a previous run have run their course, it would just
look for "run-parts" not for the actual daemon that you invoked from there.

Here's the run-parts that I use, based on the one from RedHat 8:

[durk at tuxedo durk]$ cat /usr/bin/run-parts
#!/bin/bash

set +e
if [ $# -lt 1 ] ; then
        echo "Usage: $0 <dir>"
        exit 1
fi
if [ ! -d $1 ] ; then
        echo "Not a directory: $1"
        exit 1
fi
for i in $1/*[^~,] ; do
        [ -d $i ] && continue
        if [ -x $i ] ; then
                $i 2>&1 | awk -v "progname=$i" \
                'progname {
                        print progname ":\n"
                        progname="";
                }
                { print; }'
        fi
done
exit 0

Here's the crontab itself:

[durk at tuxedo durk]$ cat /etc/fcrontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
HOME=/

# run-parts
01 * * * * root run-parts /etc/fcron.hourly
02 4 * * * root run-parts /etc/fcron.daily
22 4 * * 0 root run-parts /etc/fcron.weekly
42 4 1 * * root run-parts /etc/fcron.monthly






More information about the lfs-chat mailing list