[openssh] Improve init script

Jan F. Chadima jfch2222 at fedoraproject.org
Mon Jun 20 08:50:31 UTC 2011


commit d3542d5be8a5ee4480b1e65944b01847e32e56c6
Author: Jan F <jfch at zwingli.jagda.eu>
Date:   Mon Jun 20 10:44:49 2011 +0200

    Improve init script

 openssh.spec |    4 ++--
 sshd.init    |   10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/openssh.spec b/openssh.spec
index a3366bd..8bdcecd 100644
--- a/openssh.spec
+++ b/openssh.spec
@@ -82,7 +82,7 @@
 
 # Do not forget to bump pam_ssh_agent_auth release if you rewind the main package release to 1
 %define openssh_ver 5.8p2
-%define openssh_rel 8
+%define openssh_rel 9
 %define pam_ssh_agent_ver 0.9.2
 %define pam_ssh_agent_rel 31
 
@@ -750,7 +750,7 @@ exit 0
 %endif
 
 %changelog
-* Thu Jun 16 2011 Jan F. Chadima <jchadima at redhat.com> - 5.8p2-8 + 0.9.2-31
+* Mon Jun 20 2011 Jan F. Chadima <jchadima at redhat.com> - 5.8p2-9 + 0.9.2-31
 - Improve init script
 
 * Thu Jun 16 2011 Jan F. Chadima <jchadima at redhat.com> - 5.8p2-7 + 0.9.2-31
diff --git a/sshd.init b/sshd.init
index b08b77f..720c1d2 100755
--- a/sshd.init
+++ b/sshd.init
@@ -42,7 +42,8 @@ SSHD=/usr/sbin/sshd
 RSA1_KEY=/etc/ssh/ssh_host_key
 RSA_KEY=/etc/ssh/ssh_host_rsa_key
 DSA_KEY=/etc/ssh/ssh_host_dsa_key
-PID_FILE=/var/run/sshd.pid
+XPID_FILE=/var/run/sshd.pid
+PID_FILE=/var/run/sshd-s.pid
 
 runlevel=$(set -- $(runlevel); eval "echo \$$#" )
 
@@ -136,6 +137,7 @@ start()
 	$SSHD $OPTIONS && success || failure
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch $lockfile
+	[ $RETVAL -eq 0 ] && cp -f $XPID_FILE $PID_FILE
 	echo
 	return $RETVAL
 }
@@ -144,12 +146,12 @@ stop()
 {
 
 	echo -n $"Stopping $prog: "
-	if [ ! -f "$PIDFILE" ]; then
+	if [ ! -f "$PID_FILE" ]; then
 		# not running; per LSB standards this is "ok"
 		action $"Stopping $prog: " /bin/true
 		return 0
 	fi
-	PID=`cat "$PIDFILE"`
+	PID=`cat "$PID_FILE"`
 	if [ -n "$PID" ]; then
 		/bin/kill "$PID" >/dev/null 2>&1
 		RETVAL=$?
@@ -172,7 +174,7 @@ stop()
 	    trap TERM
 	fi
 	[ $RETVAL -eq 0 ] && rm -f $lockfile
-	rm -f "$PIDFILE"
+	rm -f "$PID_FILE"
         return $RETVAL
 }
 


More information about the scm-commits mailing list