]> git.pld-linux.org Git - packages/eventum.git/blob - eventum-irc.init
9bc89cee8a8e6b180038c00a095e109f95ec7045
[packages/eventum.git] / eventum-irc.init
1 #!/bin/sh
2 #
3 # chkconfig:    345 29 69
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
21                 exit 1
22         fi
23 else
24         exit 0
25 fi
26
27 RETVAL=0
28 # See how we were called.
29 case "$1" in
30 start)
31         if [ ! -f /var/lock/subsys/eventum-irc ]; then
32                 msg_starting eventum-irc
33                 start-stop-daemon --start \
34                         --exec /usr/bin/php \
35                         --pidfile $PIDFILE \
36                         --chuid http \
37                         --chdir /usr/share/eventum/irc \
38                         --background -- -q bot.php
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         else
48                 msg_already_running eventum-irc
49         fi
50 ;;
51 stop)
52         if [ -f /var/lock/subsys/eventum-irc ]; then
53                 msg_stopping eventum-irc
54                 if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
55                         rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
56                         ok
57                 else
58                         fail
59                 fi
60         else
61                 msg_not_running eventum-irc
62         fi
63 ;;
64 restart)
65         $0 stop
66         $0 start
67         exit $?
68 ;;
69 status)
70         status eventum-irc
71         exit $?
72 ;;
73 *)
74         msg_usage "$0 {start|stop|restart|status}"
75         exit 3
76 esac
77
78 exit $RETVAL
This page took 0.068257 seconds and 3 git commands to generate.