3 # $Id: sshd.init,v 1.4 2003/11/21 12:48:57 djm Exp $
7 # Required-Start: $network
10 # Default-Stop: 0 1 2 6
12 # Bring up/down the OpenSSH secure shell daemon.
15 # Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
16 # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
17 # Modified for OpenLinux by Raymund Will <ray@caldera.de>
20 DAEMON
=/usr
/sbin
/$NAME
21 # Hack-Alert(TM)! This is necessary to get around the 'reload'-problem
22 # created by recent OpenSSH daemon/ssd combinations. See Caldera internal
23 # PR [linux/8278] for details...
24 PIDF
=/var
/run
/$NAME.pid
28 [ -z "$1" ] ||
local pidf
="$1"
31 if [ -n "$pidf" ] && [ -r "$pidf" ]; then
37 if [ ! -e $SVIlock ]; then
38 # no lock-file => not started == stopped?
40 elif [ -n "$pidf" -a ! -f "$pidf" ] ||
[ -z "$pid" ]; then
41 # pid-file given but not present or no pid => died, but was not stopped
43 elif [ -r /proc
/$pid/cmdline
] &&
44 echo -ne $NAME'\000' |
cmp -s - /proc
/$pid/cmdline
; then
45 # pid-file given and present or pid found => check process...
46 # but don't compare exe, as this will fail after an update!
47 # compares OK => all's well, that ends well...
50 # no such process or exe does not match => stale pid-file or process died
57 # Source function library (and set vital variables).
62 [ ! -e $SVIlock ] ||
exit 0
63 [ -x $DAEMON ] ||
exit 5
64 SVIemptyConfig @sysconfdir@
/sshd_config
&& exit 6
66 if [ ! \
( -f @sysconfdir@
/ssh_host_key
-a \
67 -f @sysconfdir@
/ssh_host_key.pub \
) -a \
68 ! \
( -f @sysconfdir@
/ssh_host_rsa_key
-a \
69 -f @sysconfdir@
/ssh_host_rsa_key.pub \
) -a \
70 ! \
( -f @sysconfdir@
/ssh_host_dsa_key
-a \
71 -f @sysconfdir@
/ssh_host_dsa_key.pub \
) ]; then
73 echo "$SVIsubsys: host key not initialized: skipped!"
74 echo "$SVIsubsys: use ssh-host-keygen to generate one!"
78 echo -n "Starting $SVIsubsys services: "
79 ssd
-S -x $DAEMON -n $NAME -- $OPTIONS
87 [ -e $SVIlock ] ||
exit 0
89 echo -n "Stopping $SVIsubsys services: "
90 ssd
-K -p $PIDF -n $NAME
98 [ -e $SVIlock ] ||
exit 0
100 echo "Reloading $SVIsubsys configuration files: "
101 ssd
-K --signal 1 -q -p $PIDF -n $NAME
118 echo "Usage: $SVIscript {[re]start|stop|[force-]reload|status}"