blob: 45c34210aa8d6893b9c4ad3ad15ac775aa029efe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/sh
#
# $ Header: $
#
# 20 Apr 2002; Thilo Bangert <bangert@gentoo.org> run-crons:
#
# moved lastrun directory to /var/spool/cron/lastrun
#
#
# Author: Achim Gottinger <achim@gentoo.org>
#
# Mostly copied from SuSE
#
# this script looks into /etc/cron.[hourly|daily|weekly|monthly]
# for scripts to be executed. The info about last run is stored in
# /var/spool/cron/lastrun
mkdir -p /var/spool/cron/lastrun
#
for CRONDIR in /etc/cron.{hourly,daily,weekly,monthly}
do
test -d $CRONDIR || continue
BASE=${CRONDIR##*/}
test -e /var/spool/cron/lastrun/$BASE && {
case $BASE in
cron.hourly) TIME="-cmin +60 -or -cmin 60" ;;
cron.daily) TIME="-ctime +1 -or -ctime 1" ;;
cron.weekly) TIME="-ctime +7 -or -ctime 7" ;;
cron.monthly) TIME="-ctime +30 -or -ctime 30" ;;
esac
eval find /var/spool/cron/lastrun/$BASE $TIME | \
xargs --no-run-if-empty rm
}
if test ! -e /var/spool/cron/lastrun/$BASE ; then
touch /var/spool/cron/lastrun/$BASE
set +e
for SCRIPT in $CRONDIR/*
do
test -d $SCRIPT && continue
if test -x $SCRIPT ; then
$SCRIPT
fi
done
fi
done
#
touch /var/spool/cron/lastrun
find /var/spool/cron/lastrun -newer /var/spool/cron/lastrun | \
xargs --no-run-if-empty rm
|