Improve init script

This commit is contained in:
Jan F 2011-06-16 15:44:03 +02:00
parent 6bd5ca2e17
commit ef264f503b
2 changed files with 26 additions and 7 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 7
%define openssh_rel 8
%define pam_ssh_agent_ver 0.9.2
%define pam_ssh_agent_rel 31
@ -750,6 +750,9 @@ exit 0
%endif
%changelog
* Thu Jun 16 2011 Jan F. Chadima <jchadima@redhat.com> - 5.8p2-8 + 0.9.2-31
- Improve init script
* Thu Jun 16 2011 Jan F. Chadima <jchadima@redhat.com> - 5.8p2-7 + 0.9.2-31
- Add possibility to compile openssh without downstream patches

View File

@ -142,13 +142,28 @@ start()
stop()
{
echo -n $"Stopping $prog: "
if [ -n "`pidfileofproc $SSHD`" ] ; then
killproc $SSHD
else
failure $"Stopping $prog"
if [ ! -f "$PIDFILE" ]; then
# not running; per LSB standards this is "ok"
action $"Stopping $prog: " /bin/true
return 0
fi
PID=`cat "$PIDFILE"`
if [ -n "$PID" ]; then
/bin/kill "$PID" >/dev/null 2>&1
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
RETVAL=1
action $"Stopping $prog: " /bin/false
else
action $"Stopping $prog: " /bin/true
fi
else
# failed to read pidfile
action $"Stopping $prog: " /bin/false
RETVAL=4
fi
RETVAL=$?
# if we are in halt or reboot runlevel kill all running sessions
# so the TCP connections are closed cleanly
if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
@ -157,7 +172,8 @@ stop()
trap TERM
fi
[ $RETVAL -eq 0 ] && rm -f $lockfile
echo
rm -f "$PIDFILE"
return $RETVAL
}
reload()