]> git.pld-linux.org Git - packages/eventum.git/blob - eventum-irc.init
- fix start+stop=100 formula
[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_starting "Eventum IRC Bot"
30                 start-stop-daemon --start \
31                         --exec /usr/sbin/eventum-irc-bot \
32                         --pidfile $PIDFILE \
33                         --chuid http \
34                         --background
35
36                 RETVAL=$?
37                 if [ $RETVAL -eq 0 ]; then
38                         touch /var/lock/subsys/eventum-irc
39                         ok
40                 else
41                         fail
42                 fi
43         else
44                 msg_already_running "Eventum IRC Bot"
45         fi
46 }
47
48 stop() {
49         if [ -f /var/lock/subsys/eventum-irc ]; then
50                 msg_stopping "Eventum IRC Bot"
51                 if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
52                         rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
53                         ok
54                 else
55                         fail
56                 fi
57         else
58                 msg_not_running "Eventum IRC Bot"
59         fi
60 }
61
62 RETVAL=0
63 # See how we were called.
64 case "$1" in
65 start)
66         start
67 ;;
68 stop)
69         stop
70 ;;
71 restart)
72         stop
73         start
74 ;;
75 status)
76         status eventum-irc-bot php
77         exit $?
78 ;;
79 *)
80         msg_usage "$0 {start|stop|restart|status}"
81         exit 3
82 esac
83
84 exit $RETVAL
This page took 0.06976 seconds and 4 git commands to generate.