]>
Commit | Line | Data |
---|---|---|
161ebc28 | 1 | #!/bin/sh |
2 | # | |
3 | # crond Start/Stop the cron clock daemon. | |
4 | # | |
5 | # chkconfig: 2345 40 60 | |
6 | # | |
3fa9f38f | 7 | # description: Fcron is a periodical command scheduler which aims at replacing \ |
8 | # Vixie Cron, so it implements most of its functionalities. | |
161ebc28 | 9 | # |
10 | # processname: crond | |
11 | # config: /etc/fcron.conf | |
3fa9f38f | 12 | # pidfile: /var/run/crond.pid |
161ebc28 | 13 | |
14 | ||
15 | # Source function library | |
16 | . /etc/rc.d/init.d/functions | |
17 | ||
18 | # Get service config | |
19 | [ -f /etc/sysconfig/cron ] && . /etc/sysconfig/cron | |
20 | ||
21 | RETVAL=0 | |
22 | # See how we were called. | |
23 | case "$1" in | |
24 | start) | |
25 | # Check if the service is already running? | |
26 | if [ ! -f /var/lock/subsys/crond ]; then | |
709ddeca | 27 | msg_starting fcron |
610be4ed | 28 | [ -f /var/spool/cron/systab.orig ] && rm -rf /var/spool/cron/systab.orig |
3fa9f38f | 29 | FIND=`find /etc/cron.d/ \( -type f ! -name '*~' ! -name \*\.swp \ |
30 | ! -name \*\.rpmorig ! -name \*\.rpmnew ! -name \*\.rpmsave \)` | |
ca844cd6 | 31 | for FILE in $FIND; do |
610be4ed | 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 | |
709ddeca | 51 | |
161ebc28 | 52 | ;; |
53 | status) | |
ca844cd6 | 54 | status crond |
161ebc28 | 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 |