X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=inn.init;h=ccb7910060fabd229eb842d2ab8f211d38e6b2f8;hb=HEAD;hp=c9232ce9b7943745dfd0d70b2d8eba731526ab35;hpb=668c858105617fd16e0db09107d0cd7ca182f65a;p=packages%2Finn.git diff --git a/inn.init b/inn.init index c9232ce..ccb7910 100644 --- a/inn.init +++ b/inn.init @@ -18,103 +18,118 @@ . /usr/share/news/innshellvars # Check that networking is up. -if is_no "${NETWORKING}"; then - msg_Network_Down "INN" - exit 1 +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down "INN" + exit 1 + fi +else + exit 0 fi - -# See how we were called. -case "$1" in - start) +start() { if [ ! -f /var/lock/subsys/inn ]; then + grep -v "#" /etc/news/inn.conf | grep ovmethod | grep ovdb 2>&1 >/dev/null + RETVAL=$? + if [ $RETVAL -eq 0 ]; then + msg_starting "INN ovdb_monitor" + daemon --pidfile /var/run/news/ovdb_monitor.pid --user news ovdb_init + fi + msg_starting "INN" - daemon inndstart - if is_yes $DOINNWATCH ; then + daemon --pidfile /var/run/news/innd.pid --user news innd + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn + if is_yes "$DOINNWATCH" ; then msg_starting "INN Watch" busy - su - news -c "umask 002 ; /usr/bin/innwatch &" + daemon --fork --pidfile /var/run/news/innwatch.pid --user news /usr/bin/innwatch RETVAL=$? - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/inn - if ps -C innwatch >/dev/null 2>&1; then - deltext;ok - else - deltext;fail - fi - else - touch /var/lock/subsys/inn + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/innwatch fi else - msg_Already_Running "INN" - exit 1 + msg_already_running "INN" fi - ;; - stop) +} + +stop() { if [ -f /var/lock/subsys/inn ]; then msg_stopping "INN" busy - if ctlinnd shutdown "Stopping INN service";then - deltext;ok + if ctlinnd shutdown "Stopping INN service"; then + ok else - deltext;fail + fail fi if [ -f /var/run/news/innwatch.pid ]; then msg_stopping "INN Watch" - busy - if killall -9 innwatch; then - deltext;ok - else - deltext;died - fi + killproc --pidfile /var/run/news/innwatch.pid innwatch -9 rm -f /var/run/news/innwatch.pid \ /var/run/news/LOCK.innwatch >/dev/null 2>&1 fi if [ -f /var/run/news/infeed.pid ]; then msg_stopping "INN Feed" - killproc innfeed -9 + killproc --pidfile /var/run/news/infeed.pid innfeed -9 rm -f /var/run/news/innfeed.pid >/dev/null 2>&1 fi if [ -f /var/run/news/actived.pid ]; then msg_stopping "INN Actived" - killproc actived -9 + killproc --pidfile /var/run/news/actived.pid actived -9 rm -f /var/run/news/actived.pid >/dev/null 2>&1 fi + if [ -f /var/run/news/ovdb_monitor.pid ]; then + msg_stopping "INN ovdb_monitor" + killproc --pidfile /var/run/news/ovdb_monitor.pid ovdb_monitor -15 + rm -f /var/run/news/ovdb_monitor.pid >/dev/null 2>&1 + fi + + rm -f /var/lock/subsys/inn >/dev/null 2>&1 + else - msg_Not_Running INN - exit 1 + msg_not_running INN fi - rm -f /var/lock/subsys/inn >/dev/null 2>&1 +} + +RETVAL=0 +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop ;; status) + status innwatch status innd + if [ $? -eq 0 ]; then + innstat + fi ;; - reload) + reload|force-reload) if [ -f /var/lock/subsys/inn ]; then msg_reloading "INN" busy - if ctlinnd reload all "Reloading" >/dev/null 2>&1; then - deltext;ok - else - deltext;fail - fi + ctlinnd reload all "Reloading" >/dev/null 2>&1; + [ $? -ne 0 ] && RETVAL=7 + [ $RETVAL -eq 0 ] && ok || died else - msg_Not_Running INN - exit 1 + msg_not_running INN >&2 + exit 7 fi ;; restart) - $0 stop + stop sleep 2 - $0 start + start ;; *) - msg_Usage "$0 {start|stop|status|restart|reload}" - exit 1 - ;; + msg_usage "$0 {start|stop|restart|reload|force-reload|status}" + exit 3 esac exit $RETVAL