X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;ds=sidebyside;f=git-core.init;h=a9e0469bbbbe2b65c56b32fe3ccd2336391c341b;hb=e5a9986585e50437a3515f155d61ad5da8c96c8b;hp=dd3c1f3a9078a6da1fc55ee834ba7f4f40ed522a;hpb=975e80c2fa91aa0e5af052fe5f776215aaa03c00;p=packages%2Fgit-core.git diff --git a/git-core.init b/git-core.init index dd3c1f3..a9e0469 100644 --- a/git-core.init +++ b/git-core.init @@ -2,7 +2,7 @@ # # git-daemon git-daemon tcp daemon for git # -# chkconfig: 345 90 25 +# chkconfig: 345 90 10 # # description: git-daemon is a simple tcp daemon that serves git repositories # @@ -22,7 +22,7 @@ DAEMON_OPTS="--syslog" # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then - msg_network_down git-daemon + msg_network_down "git-daemon" exit 1 fi else @@ -31,36 +31,50 @@ fi start() { # Check if the service is already running? - if [ ! -f /var/lock/subsys/git-daemon ]; then - msg_starting git-daemon - daemon --fork git-daemon $DAEMON_OPTS - RETVAL=$? - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/git-daemon - else - msg_already_running git-daemon + if [ -f /var/lock/subsys/git-daemon ]; then + msg_already_running "git-daemon" + return fi + + msg_starting "git-daemon" + daemon --fork @libdir@/git-core/git-daemon $DAEMON_OPTS + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/git-daemon } stop() { - if [ -f /var/lock/subsys/git-daemon ]; then - # Stop daemons. - msg_stopping git-daemon - killproc git-daemon - rm -f /var/lock/subsys/git-daemon - else - msg_not_running git-daemon + if [ ! -f /var/lock/subsys/git-daemon ]; then + msg_not_running "git-daemon" + return fi + + # Stop daemons. + msg_stopping "git-daemon" + killproc git-daemon + rm -f /var/lock/subsys/git-daemon } reload() { - if [ -f /var/lock/subsys/git-daemon ]; then - msg_reloading git-daemon - killproc git-daemon -HUP - RETVAL=$? - else - msg_not_running git-daemon + if [ ! -f /var/lock/subsys/git-daemon ]; then + msg_not_running "git-daemon" RETVAL=7 + return + fi + + msg_reloading "git-daemon" + killproc git-daemon -HUP + RETVAL=$? +} + +condrestart() { + if [ ! -f /var/lock/subsys/git-daemon ]; then + msg_not_running "git-daemon" + RETVAL=$1 + return fi + + stop + start } RETVAL=0 @@ -76,20 +90,18 @@ case "$1" in stop start ;; - reload) - reload + try-restart) + condrestart 0 ;; -# ONLY if program allows reloading without stopping -# otherwise include force-reload with 'reload' - force-reload) - reload + reload|force-reload) + reload ;; status) status git-daemon RETVAL=$? ;; *) - msg_usage "$0 {start|stop|restart|reload|force-reload|status}" + msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" exit 3 esac