]> git.pld-linux.org Git - packages/eventum.git/blame - eventum-irc.init
run upgrade script as http user; keep config dir writable
[packages/eventum.git] / eventum-irc.init
CommitLineData
6f779bf8
ER
1#!/bin/sh
2#
6e3604d1 3# chkconfig: 345 29 71
6f779bf8
ER
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
f6586dd5 12PIDFILE=/var/run/eventum/irc_bot.pid
6f779bf8
ER
13
14# Get service config
15[ -f /etc/sysconfig/eventum-irc ] && . /etc/sysconfig/eventum-irc
16
17# Check that networking is up.
18if is_yes "${NETWORKING}"; then
19 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then
b1cda3c9 20 msg_network_down "Eventum IRC Bot"
6f779bf8
ER
21 exit 1
22 fi
23else
24 exit 0
25fi
26
d96129db 27start() {
f483e6d0
ER
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 \
35bb76a6 35 --exec /usr/share/eventum/bin/irc-bot.php \
5033fc13 36 -m \
f483e6d0
ER
37 --pidfile $PIDFILE \
38 --chuid http \
39 --background
6f779bf8 40
f483e6d0
ER
41 RETVAL=$?
42 if [ $RETVAL -eq 0 ]; then
43 touch /var/lock/subsys/eventum-irc
44 ok
6f779bf8 45 else
f483e6d0 46 fail
6f779bf8 47 fi
d96129db
ER
48}
49
50stop() {
f483e6d0 51 if [ ! -f /var/lock/subsys/eventum-irc ]; then
b1cda3c9 52 msg_not_running "Eventum IRC Bot"
f483e6d0
ER
53 return
54 fi
55
56 msg_stopping "Eventum IRC Bot"
57 if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
58 rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
59 ok
60 else
61 fail
6f779bf8 62 fi
d96129db
ER
63}
64
f94ebb2a
ER
65condrestart() {
66 if [ ! -f /var/lock/subsys/eventum-irc ]; then
67 msg_not_running "Eventum IRC Bot"
68 RETVAL=$1
69 return
70 fi
71
72 stop
73 start
74}
75
d96129db
ER
76RETVAL=0
77# See how we were called.
78case "$1" in
f483e6d0 79 start)
d96129db 80 start
f483e6d0
ER
81 ;;
82 stop)
d96129db 83 stop
f483e6d0
ER
84 ;;
85 restart)
d96129db
ER
86 stop
87 start
f483e6d0 88 ;;
f94ebb2a
ER
89 force-reload)
90 condrestart 7
91 ;;
f483e6d0 92 status)
5033fc13 93 status --pidfile $PIDFILE eventum-irc
6f779bf8 94 exit $?
f483e6d0
ER
95 ;;
96 *)
f94ebb2a 97 msg_usage "$0 {start|stop|restart|force-reload|status}"
6f779bf8
ER
98 exit 3
99esac
100
101exit $RETVAL
This page took 0.06049 seconds and 4 git commands to generate.