]>
Commit | Line | Data |
---|---|---|
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 | 12 | PIDFILE=/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. | |
18 | if 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 | |
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 | |
b1cda3c9 | 32 | msg_starting "Eventum IRC Bot" |
6f779bf8 | 33 | start-stop-daemon --start \ |
77220c89 | 34 | --exec /usr/sbin/eventum-bot \ |
f647bd0b | 35 | --pidfile $PIDFILE \ |
77220c89 ER |
36 | --chuid eventum \ |
37 | --background | |
6f779bf8 ER |
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 | |
b1cda3c9 | 47 | msg_already_running "Eventum IRC Bot" |
6f779bf8 ER |
48 | fi |
49 | ;; | |
50 | stop) | |
51 | if [ -f /var/lock/subsys/eventum-irc ]; then | |
b1cda3c9 | 52 | msg_stopping "Eventum IRC Bot" |
f647bd0b | 53 | if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then |
6f779bf8 ER |
54 | rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1 |
55 | ok | |
56 | else | |
57 | fail | |
58 | fi | |
59 | else | |
b1cda3c9 | 60 | msg_not_running "Eventum IRC Bot" |
6f779bf8 ER |
61 | fi |
62 | ;; | |
63 | restart) | |
64 | $0 stop | |
65 | $0 start | |
66 | exit $? | |
67 | ;; | |
68 | status) | |
b1cda3c9 | 69 | status "Eventum IRC Bot" php |
6f779bf8 ER |
70 | exit $? |
71 | ;; | |
72 | *) | |
73 | msg_usage "$0 {start|stop|restart|status}" | |
74 | exit 3 | |
75 | esac | |
76 | ||
77 | exit $RETVAL |