Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 3966
Collapse All | Expand All

(-)gentoo-x86/sys-apps/cronbase/files/run-crons (-14 / +20 lines)
Lines 19-41 Link Here
19
19
20
#
20
#
21
21
22
for CRONDIR in /etc/cron.{hourly,daily,weekly,monthly}
22
for BASE in hourly daily weekly monthly
23
do
23
do
24
   
24
    CRONDIR=/etc/cron.${BASE}
25
25
    test -d $CRONDIR || continue
26
    test -d $CRONDIR || continue
26
    BASE=${CRONDIR##*/}
27
    # if the touch file is older than {hourly,daily,...} remove it
27
    test -e /var/spool/cron/lastrun/$BASE && {
28
    # Why is this in here at all?  Don't the cron jobs from /etc/crontab 
29
    # take care of this for us?
30
    if test -f /var/spool/cron/lastrun/$BASE
31
    then
28
32
29
	case $BASE in
33
	case $BASE in
30
	    cron.hourly)  TIME="-cmin  +60 -or -cmin  60" ;;
34
	    cron.hourly)  TIME="-cmin  +59" ;;
31
	    cron.daily)   TIME="-ctime +1  -or -ctime 1"  ;;
35
	    cron.daily)   TIME="-ctime +0"  ;;
32
	    cron.weekly)  TIME="-ctime +7  -or -ctime 7"  ;;
36
	    cron.weekly)  TIME="-ctime +6"  ;;
33
	    cron.monthly) TIME="-ctime +30 -or -ctime 30" ;;
37
	    cron.monthly) TIME="-ctime +29" ;;
34
	esac
38
	esac
35
	eval find /var/spool/cron/lastrun/$BASE $TIME | \
39
	find /var/spool/cron/lastrun/$BASE $TIME -exec /bin/rm -f {} \;
36
	    xargs --no-run-if-empty rm 
40
    fi
37
    }
41
38
    if test ! -e /var/spool/cron/lastrun/$BASE ; then
42
    # if there is no touch file, make one then run the scripts 
43
    if test ! -f /var/spool/cron/lastrun/$BASE
44
    then
45
39
	touch /var/spool/cron/lastrun/$BASE
46
	touch /var/spool/cron/lastrun/$BASE
40
47
41
	set +e
48
	set +e
Lines 52-57 Link Here
52
#
59
#
53
60
54
touch /var/spool/cron/lastrun
61
touch /var/spool/cron/lastrun
55
find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun | \
62
find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun -exec /bin/rm -f {} \;
56
    xargs --no-run-if-empty rm
57
63

Return to bug 3966