]> git.pld-linux.org Git - packages/eventum.git/blame - eventum-irc.init
- run as http uid
[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
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() {
6f779bf8 28 if [ ! -f /var/lock/subsys/eventum-irc ]; then
b1cda3c9 29 msg_starting "Eventum IRC Bot"
6f779bf8 30 start-stop-daemon --start \
ae3e48e6 31 --exec /usr/sbin/eventum-irc-bot \
f647bd0b 32 --pidfile $PIDFILE \
8f8233d0 33 --chuid http \
77220c89 34 --background
6f779bf8
ER
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
b1cda3c9 44 msg_already_running "Eventum IRC Bot"
6f779bf8 45 fi
d96129db
ER
46}
47
48stop() {
6f779bf8 49 if [ -f /var/lock/subsys/eventum-irc ]; then
b1cda3c9 50 msg_stopping "Eventum IRC Bot"
f647bd0b 51 if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
6f779bf8
ER
52 rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
53 ok
54 else
55 fail
56 fi
57 else
b1cda3c9 58 msg_not_running "Eventum IRC Bot"
6f779bf8 59 fi
d96129db
ER
60}
61
62RETVAL=0
63# See how we were called.
64case "$1" in
65start)
66 start
67;;
68stop)
69 stop
6f779bf8
ER
70;;
71restart)
d96129db
ER
72 stop
73 start
6f779bf8
ER
74;;
75status)
ae3e48e6 76 status eventum-irc-bot php
6f779bf8
ER
77 exit $?
78;;
79*)
80 msg_usage "$0 {start|stop|restart|status}"
81 exit 3
82esac
83
84exit $RETVAL
This page took 0.052092 seconds and 4 git commands to generate.