X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=eventum-irc.init;h=6a0aff87de5decb56cfa43709063b2c817698f59;hb=371b276ab631c8d0f88f9387e6f31dffa7ad386a;hp=31d7752dd99e8152b817f9394f589849c5bbb7b5;hpb=6f779bf8a19cd57dd39e3823483a9312c612444b;p=packages%2Feventum.git diff --git a/eventum-irc.init b/eventum-irc.init old mode 100644 new mode 100755 index 31d7752..6a0aff8 --- a/eventum-irc.init +++ b/eventum-irc.init @@ -1,6 +1,6 @@ #!/bin/sh # -# chkconfig: 345 29 69 +# chkconfig: 345 29 71 # description: Eventum IRC Notification Bot # Source function library @@ -9,8 +9,7 @@ # Get network config . /etc/sysconfig/network -PHP=/usr/bin/php4 -PIDFILE=/usr/share/eventum/locks/irc_bot.pid +PIDFILE=/var/run/eventum/irc_bot.pid # Get service config [ -f /etc/sysconfig/eventum-irc ] && . /etc/sysconfig/eventum-irc @@ -18,61 +17,84 @@ PIDFILE=/usr/share/eventum/locks/irc_bot.pid # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then - msg_network_down eventum-irc + msg_network_down "Eventum IRC Bot" exit 1 fi else exit 0 fi -RETVAL=0 -# See how we were called. -case "$1" in -start) - if [ ! -f /var/lock/subsys/eventum-irc ]; then - msg_starting eventum-irc - start-stop-daemon --start \ - --exec $PHP \ - --pidfile $PIDFILE \ - --chuid http \ - --chdir /usr/share/eventum/misc/irc \ - --background -- -q bot.php +start() { + if [ -f /var/lock/subsys/eventum-irc ]; then + msg_already_running "Eventum IRC Bot" + return + fi - RETVAL=$? - if [ $RETVAL -eq 0 ]; then - touch /var/lock/subsys/eventum-irc - ok - else - fail - fi + msg_starting "Eventum IRC Bot" + start-stop-daemon --start \ + --exec /usr/share/eventum/bin/irc-bot.php \ + -m \ + --pidfile $PIDFILE \ + --chuid http \ + --background + + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + touch /var/lock/subsys/eventum-irc + ok else - msg_already_running eventum-irc + fail fi -;; -stop) - if [ -f /var/lock/subsys/eventum-irc ]; then - msg_stopping eventum-irc - if start-stop-daemon --stop --pidfile $PIDFILE; then - rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1 - ok - else - fail - fi +} + +stop() { + if [ ! -f /var/lock/subsys/eventum-irc ]; then + msg_not_running "Eventum IRC Bot" + return + fi + + msg_stopping "Eventum IRC Bot" + if start-stop-daemon --stop --oknodo --pidfile $PIDFILE; then + rm -f $PIDFILE /var/lock/subsys/eventum-irc >/dev/null 2>&1 + ok else - msg_not_running eventum-irc + fail fi -;; -restart) - $0 stop - $0 start - exit $? -;; -status) - status eventum-irc +} + +condrestart() { + if [ ! -f /var/lock/subsys/eventum-irc ]; then + msg_not_running "Eventum IRC Bot" + RETVAL=$1 + return + fi + + stop + start +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + force-reload) + condrestart 7 + ;; + status) + status --pidfile $PIDFILE eventum-irc exit $? -;; -*) - msg_usage "$0 {start|stop|restart|status}" + ;; + *) + msg_usage "$0 {start|stop|restart|force-reload|status}" exit 3 esac