X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=eventum-irc.init;h=6a0aff87de5decb56cfa43709063b2c817698f59;hb=371b276ab631c8d0f88f9387e6f31dffa7ad386a;hp=5894ab85d08145484016bb18c5e078bea120b5b7;hpb=6e3604d17ee570443d33ac814df74de5a1dee419;p=packages%2Feventum.git diff --git a/eventum-irc.init b/eventum-irc.init old mode 100644 new mode 100755 index 5894ab8..6a0aff8 --- a/eventum-irc.init +++ b/eventum-irc.init @@ -25,59 +25,76 @@ else fi start() { - if [ ! -f /var/lock/subsys/eventum-irc ]; then - msg_starting "Eventum IRC Bot" - start-stop-daemon --start \ - --exec /usr/sbin/eventum-irc-bot \ - --pidfile $PIDFILE \ - --chuid http \ - --background + if [ -f /var/lock/subsys/eventum-irc ]; then + msg_already_running "Eventum IRC Bot" + return + 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 - fail - fi + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + touch /var/lock/subsys/eventum-irc + ok else - msg_already_running "Eventum IRC Bot" + fail fi } stop() { - if [ -f /var/lock/subsys/eventum-irc ]; then - 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 - fail - fi + 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 + fail + fi +} + +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) start -;; -stop) + ;; + stop) stop -;; -restart) + ;; + restart) stop start -;; -status) - status eventum-irc-bot php + ;; + 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