]>
Commit | Line | Data |
---|---|---|
161ebc28 | 1 | #!/bin/sh |
2 | # | |
3 | # crond Start/Stop the cron clock daemon. | |
4 | # | |
5 | # chkconfig: 2345 40 60 | |
6 | # | |
7 | # description: cron is a standard UNIX program that runs user-specified \ | |
8 | # programs at periodic scheduled times. hc-cron adds a number \ | |
9 | # of features to the basic UNIX cron, including better security \ | |
10 | # and more powerful configuration options. | |
11 | # | |
12 | # processname: crond | |
13 | # config: /etc/fcron.conf | |
14 | # pidfile: /var/run/fcron.pid | |
15 | ||
16 | ||
17 | # Source function library | |
18 | . /etc/rc.d/init.d/functions | |
19 | ||
20 | # Get service config | |
21 | [ -f /etc/sysconfig/cron ] && . /etc/sysconfig/cron | |
22 | ||
23 | RETVAL=0 | |
24 | # See how we were called. | |
25 | case "$1" in | |
26 | start) | |
27 | # Check if the service is already running? | |
28 | if [ ! -f /var/lock/subsys/crond ]; then | |
29 | msg_starting fcron | |
610be4ed | 30 | [ -f /var/spool/cron/systab.orig ] && rm -rf /var/spool/cron/systab.orig |
31 | for FILE in /etc/cron.d/*[!~]; do | |
32 | cat $FILE >>/var/spool/cron/systab.orig | |
33 | done | |
34 | fcrontab -u systab -z > /dev/null 2>&1 | |
a739bd79 | 35 | daemon /usr/sbin/crond -b -c /etc/fcron.conf |
161ebc28 | 36 | RETVAL=$? |
37 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond | |
38 | else | |
39 | msg_already_running fcron | |
40 | fi | |
41 | ;; | |
42 | stop) | |
43 | # Stop daemons. | |
44 | if [ -f /var/lock/subsys/crond ]; then | |
45 | msg_stopping fcron | |
a739bd79 | 46 | killproc crond |
161ebc28 | 47 | rm -f /var/lock/subsys/crond >/dev/null 2>&1 |
48 | else | |
49 | msg_not_running fcron | |
50 | fi | |
51 | ||
52 | ;; | |
53 | status) | |
54 | status fcron | |
55 | exit $? | |
56 | ;; | |
57 | restart|force-reload) | |
58 | $0 stop | |
59 | $0 start | |
60 | exit $? | |
61 | ;; | |
62 | *) | |
63 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
64 | exit 3 | |
65 | esac | |
66 | ||
67 | exit $RETVAL |