1
0
Files
2022-09-29 17:59:04 +03:00

69 lines
1.4 KiB
Bash
Executable File

#! /sbin/sh
#Tag 0x00000f00
# cron control
# "$Revision: 1.23 $"
DIR=/etc/cron.d
OPTIONS=/etc/config/cron.options
case $1 in
'start')
for name in at cron
do
cfgfile=$DIR/${name}.cfg
if [ -r $cfgfile ]
then
grep '^configured$' $cfgfile 1>/dev/null 2>&1
if [ $? -ne 0 ]
then
cat <<- EOF >$cfgfile
# This file records whether the
# cron and at allow/deny files have
# been configured, and to disambiguate
# the presence/absence of those files.
configured
EOF
if [ -r $DIR/${name}.allow -o -r $DIR/${name}.deny ]
then
# from a previous install - leave alone
continue
else
touch $DIR/${name}.deny
fi
fi
else
cat <<- EOF >$cfgfile
# This file records whether the
# cron and at allow/deny files have
# been configured, and to disambiguate
# the presence/absence of those files.
configured
EOF
if [ -r $DIR/${name}.allow -o -r $DIR/${name}.deny ]
then
continue;
fi
touch $DIR/${name}.deny
fi
done
if test -x /sbin/cron; then
trap "" 15 # do not kill ourself,
killall 15 cron # but prevent 2 crons
rm -f /etc/cron.d/FIFO
/sbin/suattr -C CAP_SETGID,CAP_SETUID,CAP_AUDIT_CONTROL,CAP_AUDIT_WRITE,CAP_MAC_RELABEL_OPEN,CAP_MAC_RELABEL_SUBJ,CAP_MAC_MLD,CAP_MAC_READ+ip -c "/sbin/cron ""`cat $OPTIONS 2> /dev/null`"
fi
;;
'stop')
/sbin/killall 15 cron
;;
*)
echo "usage: /etc/init.d/cron {start|stop}"
;;
esac