]>
Commit | Line | Data |
---|---|---|
74435928 | 1 | #!/bin/sh |
74435928 | 2 | # |
52685606 | 3 | # anacrond Start/Stop the cron clock daemon. |
4 | # | |
5 | # chkconfig: 2345 40 60 | |
6 | # | |
7 | # description: Anacron a periodic command scheduler. | |
8 | # | |
9 | # processname: anacron | |
10 | # config: /etc/anacrontab | |
9dc36dd9 | 11 | # pidfile: /var/lock/subsys/anacron |
74435928 | 12 | |
52685606 | 13 | |
14 | # Source function library | |
74435928 | 15 | . /etc/rc.d/init.d/functions |
16 | ||
52685606 | 17 | # Get service config |
18 | [ -f /etc/sysconfig/anacron ] && . /etc/sysconfig/anacron | |
19 | ||
74435928 | 20 | |
52685606 | 21 | # See how we were called. |
74435928 | 22 | case "$1" in |
23 | start) | |
52685606 | 24 | # Check if the service is already running? |
9dc36dd9 | 25 | if [ ! -f /var/lock/subsys/anacron ]; then |
52685606 | 26 | msg_starting Anacron |
74435928 | 27 | daemon anacron |
52685606 | 28 | RETVAL=$? |
9dc36dd9 | 29 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/anacron |
52685606 | 30 | else |
f1f15ba3 | 31 | msg_already_running Anacron |
52685606 | 32 | exit 1 |
33 | fi | |
34 | ;; | |
74435928 | 35 | stop) |
52685606 | 36 | # Stop daemons. |
9dc36dd9 | 37 | if [ -f /var/lock/subsys/anacron ]; then |
38 | msg_stopping Anacron | |
39 | if [ `pidofproc anacron` ]; then | |
40 | # if anacron is yet running | |
41 | killproc anacron; | |
42 | else | |
43 | ok; | |
44 | fi | |
45 | rm -f /var/lock/subsys/anacron >/dev/null 2>&1 | |
52685606 | 46 | else |
f1f15ba3 | 47 | msg_not_running Anacron |
52685606 | 48 | exit 1 |
49 | fi | |
50 | ;; | |
51 | status) | |
52 | status anacron | |
53 | ;; | |
54 | restart) | |
55 | $0 stop | |
56 | $0 start | |
57 | ;; | |
74435928 | 58 | *) |
f1f15ba3 | 59 | msg_usage: "$0 {start|stop|status|restart}" |
52685606 | 60 | exit 1 |
74435928 | 61 | esac |
62 | ||
52685606 | 63 | exit $RETVAL |