]>
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 |
ca844cd6 | 31 | FIND=`find /etc/cron.d/ \( -type f ! -name '*~' ! -name \*\.rpmnew ! -name \*\.rpmsave \)` |
32 | for FILE in $FIND; do | |
610be4ed | 33 | cat $FILE >>/var/spool/cron/systab.orig |
34 | done | |
35 | fcrontab -u systab -z > /dev/null 2>&1 | |
a739bd79 | 36 | daemon /usr/sbin/crond -b -c /etc/fcron.conf |
161ebc28 | 37 | RETVAL=$? |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond | |
39 | else | |
40 | msg_already_running fcron | |
41 | fi | |
42 | ;; | |
43 | stop) | |
44 | # Stop daemons. | |
45 | if [ -f /var/lock/subsys/crond ]; then | |
46 | msg_stopping fcron | |
a739bd79 | 47 | killproc crond |
161ebc28 | 48 | rm -f /var/lock/subsys/crond >/dev/null 2>&1 |
49 | else | |
50 | msg_not_running fcron | |
51 | fi | |
52 | ||
53 | ;; | |
54 | status) | |
ca844cd6 | 55 | status crond |
161ebc28 | 56 | exit $? |
57 | ;; | |
58 | restart|force-reload) | |
59 | $0 stop | |
60 | $0 start | |
61 | exit $? | |
62 | ;; | |
63 | *) | |
64 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
65 | exit 3 | |
66 | esac | |
67 | ||
68 | exit $RETVAL |