]> git.pld-linux.org Git - packages/cronie.git/blob - cronie.init
- status --pidfile dep in initscript
[packages/cronie.git] / cronie.init
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/cron.d
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_already_running "cronie crond"
26                 return
27         fi
28
29         msg_starting "cronie crond"
30         daemon /usr/sbin/crond
31         RETVAL=$?
32         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond
33 }
34
35 stop() {
36         if [ ! -f /var/lock/subsys/crond ]; then
37                 msg_not_running "cronie crond"
38                 return
39         fi
40
41         msg_stopping "cronie crond"
42         killproc crond
43         rm -f /var/lock/subsys/crond
44 }
45
46 reload() {
47         if [ ! -f /var/lock/subsys/crond ]; then
48                 msg_not_running "cronie crond"
49                 RETVAL=7
50                 return
51         fi
52
53         msg_reloading "cronie crond"
54         killproc crond -HUP
55         RETVAL=$?
56 }
57
58 condrestart() {
59         if [ ! -f /var/lock/subsys/crond ]; then
60                 msg_not_running "cronie crond"
61                 RETVAL=$1
62                 return
63         fi
64
65         stop
66         start
67 }
68
69 RETVAL=0
70 # See how we were called.
71 case "$1" in
72   start)
73         start
74         ;;
75   stop)
76         stop
77         ;;
78   restart)
79         stop
80         start
81         ;;
82   try-restart)
83         condrestart 0
84         ;;
85   reload|force-reload|flush-logs)
86         reload
87         ;;
88   status)
89         status --pidfile /var/run/crond.pid crond
90         exit $?
91         ;;
92   *)
93         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
94         exit 3
95 esac
96
97 exit $RETVAL
This page took 0.053421 seconds and 3 git commands to generate.