index 7601784..f96cb82 100644 --- a/wrappers/initscript.in +++ b/wrappers/initscript.in @@ -361,8 +361,11 @@ case "$1" in condrestart) [ ! -f $lockfile ] || restart ;; + condstop) + [ -f $lockfile ] && stop || : + ;; *) echo Unknown command $1 - echo "Usage: $0 {start|stop|status|restart|condrestart} [instance-name]" + echo "Usage: $0 {start|stop|status|restart|condrestart|condstop} [instance-name]" exit 2 esac diff --git a/wrappers/ldap-agent-initscript.in b/wrappers/ldap-agent-initscript.in index dd8ee97..104dd87 100644 --- a/wrappers/ldap-agent-initscript.in +++ b/wrappers/ldap-agent-initscript.in @@ -206,6 +206,16 @@ condrestart() { fi } +condstop() { + if [ -f $pidfile ]; then + pid=`cat $pidfile` + name=`ps -p $pid | tail -1 | awk '{ print $4 }'` + if kill -0 $pid && [ $name = "$processname" ]; then + stop + fi + fi +} + status() { ret=0 if [ -f $pidfile ]; then @@ -225,7 +235,7 @@ status() { case "$1" in - start|stop|restart|reload|condrestart|status) + start|stop|restart|reload|condrestart|condstop|status) $1 ;; *)