]> git.pld-linux.org Git - packages/eventum.git/blob - eventum-irc.init
- nice name for service
[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 Bot"
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 Bot"
33                 start-stop-daemon --start \
34                         --exec /usr/sbin/eventum-bot \
35                         --pidfile $PIDFILE \
36                         --chuid eventum \
37                         --background
38
39                 RETVAL=$?
40                 if [ $RETVAL -eq 0 ]; then
41                         touch /var/lock/subsys/eventum-irc
42                         ok
43                 else
44                         fail
45                 fi
46         else
47                 msg_already_running "Eventum IRC Bot"
48         fi
49 ;;
50 stop)
51         if [ -f /var/lock/subsys/eventum-irc ]; then
52                 msg_stopping "Eventum IRC Bot"
53                 if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then
54                         rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1
55                         ok
56                 else
57                         fail
58                 fi
59         else
60                 msg_not_running "Eventum IRC Bot"
61         fi
62 ;;
63 restart)
64         $0 stop
65         $0 start
66         exit $?
67 ;;
68 status)
69         status "Eventum IRC Bot" php
70         exit $?
71 ;;
72 *)
73         msg_usage "$0 {start|stop|restart|status}"
74         exit 3
75 esac
76
77 exit $RETVAL
This page took 0.050481 seconds and 4 git commands to generate.