From: michael@cantor.informatik.rwth-aachen.de (Michael Haardt)
To: ylo@cs.hut.fi
Subject: Re: ssh
Date: Sun, 11 Feb 1996 01:04:24 +0100

...

I appended a shell script to this email, which starts/stops sshd in SYSV
like style.  If you are interested, you can include it in the
distribution.  It goes to /etc/init.d/sshd and has symlinks from the
/etc/rc?.d directories to it, but the details of those links differ
among systems.  SYSV admins will know what to do with the script,
though.  :)

...

Michael
----------------------------------------------------------------------
#!/bin/sh
#
# Start/Stop the secure shell daemon.
#
# Written by Michael Haardt, 1996.

PATH=/bin:/usr/bin
SSHD=/usr/sbin/sshd
PID=/var/run/sshd.pid

case $1 in
  #{{{script}}}#{{{ start
  'start')
    start=false
    if [ ! -s $PID ]
    then
      start=true
    else
      kill -0 `cat $PID` >/dev/null 2>&1 || start=true
    fi
    if [ $start = true -a -x $SSHD ]
    then
      $SSHD
      echo 'Secure shell daemon started.'
    else
      echo 'Secure shell daemon not started.'
    fi
  ;;
  #}}}
  #{{{ stop
  'stop')
    if [ -s $PID ]
    then
      if kill `cat $PID` >/dev/null 2>&1
      then
        echo 'Secure shell daemon terminated.'
      fi
    fi
  ;;
  #}}}
  #{{{ *
  *)
    echo 'Usage: /etc/init.d/sshd start|stop'
    ;;
  #}}}
esac

