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