#!/bin/sh
#
# Start/Stop the secure shell daemon.
#
# Originally Written by Michael Haardt, 1996.
#
# Sean Boran for Solaris 2.4 and later:
# cp startup-script /etc/init.d/sshd
# ln -s /etc/init.d/sshd /etc/rc2.d/S10sshd
# ln -s /etc/init.d/sshd /etc/rc2.d/K10sshd

PATH=/bin:/usr/bin:/usr/local/bin
SSHD=/usr/local/sbin/sshd
PID=/etc/sshd.pid

case $1 in
  '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 'SSH1 Secure shell daemon started.'
    else
      echo 'SSH1 Secure shell daemon not started.'
    fi
  ;;
  'stop')
    if [ -s $PID ]
    then
      if kill `cat $PID` >/dev/null 2>&1
      then
        echo 'SSH1 Secure shell daemon terminated.'
      fi
    fi
  ;;
  *)
    echo 'Usage: /etc/init.d/sshd start|stop'
    ;;
esac

