blob: 050c37e4534e0840a769083728e4ce8353de82f3 (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#!/bin/sh
### BEGIN INIT INFO
# Provides: crond crontab
# Default-Start: 2345
# Default-Stop: 016
# Short-Description: run cron daemon
# Description: cron is a standard UNIX program that runs user-specified
# programs at periodic scheduled times. vixie cron adds a
# number of features to the basic UNIX cron, including better
# security and more powerful configuration options.
### END INIT INFO
CROND=/usr/sbin/crond
CONFIG=/etc/sysconfig/crond
[ -f $CONFIG ] || exit 1
[ -x $CROND ] || exit 1
. $CONFIG
# Source function library.
. /etc/init.d/functions
UID=`id -u`
case "$1" in
start)
if [ $UID -ne 0 ] ; then
echo "User has insufficient privilege."
exit 1
fi
echo -n "Starting crond: "
start-stop-daemon --start --quiet --exec $CROND -- $CRONDARGS
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "OK"
else
echo "FAIL"
fi
;;
stop)
if [ $UID -ne 0 ] ; then
echo "User has insufficient privilege."
exit 1
fi
echo -n "Stopping crond: "
start-stop-daemon --stop --quiet --pidfile /var/run/crond.pid
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
echo "OK"
else
echo "FAIL"
fi
;;
status)
if [ -n "`/bin/pidof $CROND`" ] ; then
echo "crond is running."
else
echo "crond is not running."
fi
;;
restart)
$0 stop && sleep 1 && $0 start
;;
*)
echo "Usage: /etc/init.d/crond {start|stop|status|restart}"
exit 1
esac
exit 0
|