]> git.pld-linux.org Git - packages/eventum.git/blame_incremental - eventum-irc.init
adapter
[packages/eventum.git] / eventum-irc.init
... / ...
CommitLineData
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
12PIDFILE=/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.
18if 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
23else
24 exit 0
25fi
26
27start() {
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 \
35 --exec /usr/sbin/eventum-irc-bot \
36 --pidfile $PIDFILE \
37 --chuid http \
38 --background
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}
48
49stop() {
50 if [ ! -f /var/lock/subsys/eventum-irc ]; then
51 msg_not_running "Eventum IRC Bot"
52 return
53 fi
54
55 msg_stopping "Eventum IRC Bot"
56 if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
57 rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
58 ok
59 else
60 fail
61 fi
62}
63
64condrestart() {
65 if [ ! -f /var/lock/subsys/eventum-irc ]; then
66 msg_not_running "Eventum IRC Bot"
67 RETVAL=$1
68 return
69 fi
70
71 stop
72 start
73}
74
75RETVAL=0
76# See how we were called.
77case "$1" in
78 start)
79 start
80 ;;
81 stop)
82 stop
83 ;;
84 restart)
85 stop
86 start
87 ;;
88 force-reload)
89 condrestart 7
90 ;;
91 status)
92 status eventum-irc-bot php
93 exit $?
94 ;;
95 *)
96 msg_usage "$0 {start|stop|restart|force-reload|status}"
97 exit 3
98esac
99
100exit $RETVAL
This page took 0.069194 seconds and 4 git commands to generate.