]>
Commit | Line | Data |
---|---|---|
2f80c398 ER |
1 | #!/bin/sh |
2 | # | |
3 | # crond Start/Stop the cron clock daemon. | |
4 | # | |
5 | # chkconfig: 2345 40 60 | |
6 | # description: cron is a standard UNIX program that runs user-specified \ | |
7 | # programs at periodic scheduled times. dcron adds a \ | |
8 | # number of features to the basic UNIX cron, including better \ | |
9 | # security and more powerful configuration options. | |
10 | # | |
11 | # processname: crond | |
12 | # config: /etc/cron.d | |
13 | # pidfile: /var/run/crond.pid | |
14 | ||
15 | ||
16 | # Source function library. | |
17 | . /etc/rc.d/init.d/functions | |
18 | ||
19 | CROND_ARGS="" | |
20 | ||
21 | # Get service config | |
22 | [ -f /etc/sysconfig/cron ] && . /etc/sysconfig/cron | |
23 | ||
24 | start() { | |
25 | # Check if the service is already running? | |
26 | if [ -f /var/lock/subsys/crond ]; then | |
27 | msg_already_running "dcron crond" | |
28 | return | |
29 | fi | |
30 | ||
31 | msg_starting "dcron crond" | |
32 | daemon /usr/sbin/crond $CROND_ARGS | |
33 | RETVAL=$? | |
34 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond | |
35 | } | |
36 | ||
37 | stop() { | |
38 | if [ ! -f /var/lock/subsys/crond ]; then | |
39 | msg_not_running "dcron crond" | |
40 | return | |
41 | fi | |
42 | ||
43 | msg_stopping "dcron crond" | |
44 | killproc crond | |
45 | rm -f /var/lock/subsys/crond | |
46 | } | |
47 | ||
48 | reload() { | |
49 | if [ ! -f /var/lock/subsys/crond ]; then | |
50 | msg_not_running "dcron crond" | |
51 | RETVAL=7 | |
52 | return | |
53 | fi | |
54 | ||
55 | msg_reloading "dcron crond" | |
56 | killproc crond -HUP | |
57 | RETVAL=$? | |
58 | } | |
59 | ||
60 | condrestart() { | |
61 | if [ ! -f /var/lock/subsys/crond ]; then | |
62 | msg_not_running "dcron crond" | |
63 | RETVAL=$1 | |
64 | return | |
65 | fi | |
66 | ||
67 | stop | |
68 | start | |
69 | } | |
70 | ||
71 | upstart_controlled | |
72 | ||
73 | RETVAL=0 | |
74 | # See how we were called. | |
75 | case "$1" in | |
76 | start) | |
77 | start | |
78 | ;; | |
79 | stop) | |
80 | stop | |
81 | ;; | |
82 | restart) | |
83 | stop | |
84 | start | |
85 | ;; | |
86 | try-restart) | |
87 | condrestart 0 | |
88 | ;; | |
89 | reload|force-reload|flush-logs) | |
90 | reload | |
91 | ;; | |
92 | status) | |
93 | status --pidfile /var/run/crond.pid crond | |
94 | exit $? | |
95 | ;; | |
96 | *) | |
97 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}" | |
98 | exit 3 | |
99 | esac | |
100 | ||
101 | exit $RETVAL |