]> git.pld-linux.org Git - packages/cronie.git/blame - cronie.init
- release 2
[packages/cronie.git] / cronie.init
CommitLineData
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
ae05e276 12# config: /etc/cron.d
9088c091
AM
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
22start() {
23 # Check if the service is already running?
ee7fe710
ER
24 if [ -f /var/lock/subsys/crond ]; then
25 msg_already_running "cronie crond"
26 return
9088c091 27 fi
ee7fe710
ER
28
29 msg_starting "cronie crond"
30 daemon /usr/sbin/crond
31 RETVAL=$?
32 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/crond
9088c091
AM
33}
34
35stop() {
ee7fe710
ER
36 if [ ! -f /var/lock/subsys/crond ]; then
37 msg_not_running "cronie crond"
38 return
9088c091 39 fi
ee7fe710
ER
40
41 msg_stopping "cronie crond"
42 killproc crond
43 rm -f /var/lock/subsys/crond
44}
45
46reload() {
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
58condrestart() {
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
9088c091
AM
67}
68
69RETVAL=0
70# See how we were called.
71case "$1" in
72 start)
73 start
74 ;;
75 stop)
76 stop
77 ;;
9088c091
AM
78 restart)
79 stop
80 start
81 ;;
ee7fe710
ER
82 try-restart)
83 condrestart 0
84 ;;
17ffa6b5 85 reload|force-reload|flush-logs)
ee7fe710
ER
86 reload
87 ;;
88 status)
02a3c1b6 89 status --pidfile /var/run/crond.pid crond
ee7fe710 90 exit $?
9088c091
AM
91 ;;
92 *)
17ffa6b5 93 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|flush-logs|status}"
9088c091
AM
94 exit 3
95esac
96
97exit $RETVAL
This page took 0.139913 seconds and 4 git commands to generate.