[packages/openssh] use pidfile in status

glen glen at pld-linux.org
Mon Jan 27 19:40:42 CET 2014


commit df55b69cd8b2ad81d2a795d350754fcbfa9e13e1
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Jan 27 20:40:38 2014 +0200

    use pidfile in status

 opensshd.init | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/opensshd.init b/opensshd.init
index 434d4ff..ab59061 100755
--- a/opensshd.init
+++ b/opensshd.init
@@ -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 $?
 	;;
   *)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/openssh.git/commitdiff/df55b69cd8b2ad81d2a795d350754fcbfa9e13e1



More information about the pld-cvs-commit mailing list