]> git.pld-linux.org Git - packages/eventum.git/blame - eventum-irc.init
- on stop, invalid pidfile is ok
[packages/eventum.git] / eventum-irc.init
CommitLineData
6f779bf8
ER
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
12PHP=/usr/bin/php4
13PIDFILE=/usr/share/eventum/locks/irc_bot.pid
14
15# Get service config
16[ -f /etc/sysconfig/eventum-irc ] && . /etc/sysconfig/eventum-irc
17
18# Check that networking is up.
19if is_yes "${NETWORKING}"; then
20 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
21 msg_network_down eventum-irc
22 exit 1
23 fi
24else
25 exit 0
26fi
27
28RETVAL=0
29# See how we were called.
30case "$1" in
31start)
32 if [ ! -f /var/lock/subsys/eventum-irc ]; then
33 msg_starting eventum-irc
34 start-stop-daemon --start \
f647bd0b
ER
35 --exec $PHP \
36 --pidfile $PIDFILE \
37 --chuid http \
38 --chdir /usr/share/eventum/misc/irc \
39 --background -- -q bot.php
6f779bf8
ER
40
41 RETVAL=$?
42 if [ $RETVAL -eq 0 ]; then
43 touch /var/lock/subsys/eventum-irc
44 ok
45 else
46 fail
47 fi
48 else
49 msg_already_running eventum-irc
50 fi
51;;
52stop)
53 if [ -f /var/lock/subsys/eventum-irc ]; then
54 msg_stopping eventum-irc
f647bd0b 55 if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
6f779bf8
ER
56 rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
57 ok
58 else
59 fail
60 fi
61 else
62 msg_not_running eventum-irc
63 fi
64;;
65restart)
66 $0 stop
67 $0 start
68 exit $?
69;;
70status)
71 status eventum-irc
72 exit $?
73;;
74*)
75 msg_usage "$0 {start|stop|restart|status}"
76 exit 3
77esac
78
79exit $RETVAL
This page took 0.088568 seconds and 4 git commands to generate.