]>
Commit | Line | Data |
---|---|---|
9088c091 AM |
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. cronie 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/crontab | |
13 | # pidfile: /var/run/crond.pid | |
14 | ||
15 | ||
16 | # Source function library. | |
17 | . /etc/rc.d/init.d/functions | |
18 | ||
19 | # Get service config | |
20 | [ -f /etc/sysconfig/cron ] && . /etc/sysconfig/cron | |
21 | ||
22 | start() { | |
23 | # Check if the service is already running? | |
24 | if [ ! -f /var/lock/subsys/crond ]; then | |
25 | msg_starting "cronie" | |
26 | daemon /usr/sbin/crond | |
27 | RETVAL=$? | |
28 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond | |
29 | else | |
30 | msg_already_running "cronie" | |
31 | fi | |
32 | } | |
33 | ||
34 | stop() { | |
35 | if [ -f /var/lock/subsys/crond ]; then | |
36 | msg_stopping "cronie" | |
37 | killproc crond | |
38 | rm -f /var/lock/subsys/crond | |
39 | else | |
40 | msg_not_running "cronie" | |
41 | fi | |
42 | } | |
43 | ||
44 | RETVAL=0 | |
45 | # See how we were called. | |
46 | case "$1" in | |
47 | start) | |
48 | start | |
49 | ;; | |
50 | stop) | |
51 | stop | |
52 | ;; | |
53 | status) | |
54 | status crond | |
55 | exit $? | |
56 | ;; | |
57 | restart) | |
58 | stop | |
59 | start | |
60 | ;; | |
61 | reload|force-reload) | |
62 | if [ -f /var/lock/subsys/crond ]; then | |
63 | msg_reloading "cronie" | |
64 | killproc crond -HUP | |
65 | RETVAL=$? | |
66 | else | |
67 | msg_not_running "cronie" | |
68 | exit 7 | |
69 | fi | |
70 | ;; | |
71 | *) | |
72 | msg_usage "$0 {start|stop|restart|reload|force-reload|status}" | |
73 | exit 3 | |
74 | esac | |
75 | ||
76 | exit $RETVAL |