]> git.pld-linux.org Git - packages/eventum.git/blob - eventum-irc.init
- unify with template.init
[packages/eventum.git] / eventum-irc.init
1 #!/bin/sh
2 #
3 # chkconfig:    345 29 71
4 # description:  Eventum IRC Notification Bot
5
6 # Source function library
7 . /etc/rc.d/init.d/functions
8
9 # Get network config
10 . /etc/sysconfig/network
11
12 PIDFILE=/var/run/eventum/irc_bot.pid
13
14 # Get service config
15 [ -f /etc/sysconfig/eventum-irc ] && . /etc/sysconfig/eventum-irc
16
17 # Check that networking is up.
18 if is_yes "${NETWORKING}"; then
19         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
20                 msg_network_down "Eventum IRC Bot"
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 start() {
28         if [ -f /var/lock/subsys/eventum-irc ]; then
29                 msg_already_running "Eventum IRC Bot"
30                 return
31         fi
32
33         msg_starting "Eventum IRC Bot"
34         start-stop-daemon --start \
35                 --exec /usr/sbin/eventum-irc-bot \
36                 --pidfile $PIDFILE \
37                 --chuid http \
38                 --background
39
40         RETVAL=$?
41         if [ $RETVAL -eq 0 ]; then
42                 touch /var/lock/subsys/eventum-irc
43                 ok
44         else
45                 fail
46         fi
47 }
48
49 stop() {
50         if [ ! -f /var/lock/subsys/eventum-irc ]; then
51                 msg_not_running "Eventum IRC Bot"
52                 return
53         fi
54
55         msg_stopping "Eventum IRC Bot"
56         if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
57                 rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
58                 ok
59         else
60                 fail
61         fi
62 }
63
64 RETVAL=0
65 # See how we were called.
66 case "$1" in
67   start)
68         start
69         ;;
70   stop)
71         stop
72         ;;
73   restart)
74         stop
75         start
76         ;;
77   status)
78         status eventum-irc-bot php
79         exit $?
80         ;;
81   *)
82         msg_usage "$0 {start|stop|restart|status}"
83         exit 3
84 esac
85
86 exit $RETVAL
This page took 0.033755 seconds and 4 git commands to generate.