]> git.pld-linux.org Git - packages/openssh.git/commitdiff
use pidfile in status
authorElan Ruusamäe <glen@delfi.ee>
Mon, 27 Jan 2014 18:40:38 +0000 (20:40 +0200)
committerElan Ruusamäe <glen@delfi.ee>
Mon, 27 Jan 2014 18:40:38 +0000 (20:40 +0200)
opensshd.init

index 434d4ff09d7e63cc83f21e4958cc601ef34b0771..ab59061b6e528a458878d3b90b8e1d42cd5d7d17 100755 (executable)
@@ -17,6 +17,7 @@ upstart_controlled --except init configtest
 . /etc/sysconfig/network
 
 SSHD_OOM_ADJUST=-1000
+PIDFILE=/var/run/sshd.pid
 
 # Get service config
 [ -f /etc/sysconfig/sshd ] && . /etc/sysconfig/sshd
@@ -32,8 +33,8 @@ else
 fi
 
 adjust_oom() {
-       if [ -e /var/run/sshd.pid ]; then
-               for pid in $(cat /var/run/sshd.pid); do
+       if [ -e $PIDFILE ]; then
+               for pid in $(cat $PIDFILE); do
                        echo "$SSHD_OOM_ADJUST" 2>/dev/null > /proc/$pid/oom_score_adj
                done
        fi
@@ -91,7 +92,7 @@ start() {
        fi
 
        msg_starting "OpenSSH"
-       daemon --pidfile /var/run/sshd.pid /usr/sbin/sshd $OPTIONS
+       daemon --pidfile $PIDFILE /usr/sbin/sshd $OPTIONS
        RETVAL=$?
        adjust_oom
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd
@@ -107,7 +108,7 @@ stop() {
        # we use start-stop-daemon to stop sshd, as it is unacceptable for such
        # critical service as sshd to kill it by procname, but unfortunately
        # rc-scripts does not provide way to kill *only* by pidfile
-       start-stop-daemon --stop --quiet --pidfile /var/run/sshd.pid && ok || fail
+       start-stop-daemon --stop --quiet --pidfile $PIDFILE && ok || fail
        rm -f /var/lock/subsys/sshd >/dev/null 2>&1
 }
 
@@ -166,7 +167,7 @@ case "$1" in
        ssh_gen_keys
        ;;
   status)
-       status sshd
+       status --pidfile $PIDFILE sshd
        exit $?
        ;;
   *)
This page took 0.043921 seconds and 4 git commands to generate.