]>
Commit | Line | Data |
---|---|---|
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 | 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 | ||
d96129db | 27 | start() { |
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 \ | |
35 | --exec /usr/sbin/eventum-irc-bot \ | |
36 | --pidfile $PIDFILE \ | |
37 | --chuid http \ | |
38 | --background | |
6f779bf8 | 39 | |
f483e6d0 ER |
40 | RETVAL=$? |
41 | if [ $RETVAL -eq 0 ]; then | |
42 | touch /var/lock/subsys/eventum-irc | |
43 | ok | |
6f779bf8 | 44 | else |
f483e6d0 | 45 | fail |
6f779bf8 | 46 | fi |
d96129db ER |
47 | } |
48 | ||
49 | stop() { | |
f483e6d0 | 50 | if [ ! -f /var/lock/subsys/eventum-irc ]; then |
b1cda3c9 | 51 | msg_not_running "Eventum IRC Bot" |
f483e6d0 ER |
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 | |
6f779bf8 | 61 | fi |
d96129db ER |
62 | } |
63 | ||
64 | RETVAL=0 | |
65 | # See how we were called. | |
66 | case "$1" in | |
f483e6d0 | 67 | start) |
d96129db | 68 | start |
f483e6d0 ER |
69 | ;; |
70 | stop) | |
d96129db | 71 | stop |
f483e6d0 ER |
72 | ;; |
73 | restart) | |
d96129db ER |
74 | stop |
75 | start | |
f483e6d0 ER |
76 | ;; |
77 | status) | |
ae3e48e6 | 78 | status eventum-irc-bot php |
6f779bf8 | 79 | exit $? |
f483e6d0 ER |
80 | ;; |
81 | *) | |
6f779bf8 ER |
82 | msg_usage "$0 {start|stop|restart|status}" |
83 | exit 3 | |
84 | esac | |
85 | ||
86 | exit $RETVAL |