Improve init script

This commit is contained in:
Jan F 2011-06-20 10:44:49 +02:00
parent ef264f503b
commit d3542d5be8
2 changed files with 8 additions and 6 deletions

View File

@ -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@redhat.com> - 5.8p2-8 + 0.9.2-31
* Mon Jun 20 2011 Jan F. Chadima <jchadima@redhat.com> - 5.8p2-9 + 0.9.2-31
- Improve init script
* Thu Jun 16 2011 Jan F. Chadima <jchadima@redhat.com> - 5.8p2-7 + 0.9.2-31

View File

@ -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
}