#!/bin/sh # # /etc/init.d/sshd - start/stop sshd # # Author: NISHIMURA Daisuke # # $Id: sshd,v 1.1 1998/11/06 12:22:42 nishi Exp $ # ConfigFile=/etc/sshd_config [ -f $ConfigFile ] || exit 0 PidFile=`/usr/bin/nawk -F'[ \t=]+' '/^(#|$)/ {next} tolower($1)=="pidfile" { PidFile=$2 } END {print PidFile}' PidFile=/etc/sshd.pid $ConfigFile` [ -f $PidFile ] && PidFilePid=`cat $PidFile` RunningPids=`/usr/bin/ps -e | /usr/bin/awk '$4~/^sshd/ {print $1}'` case "$1" in 'start') if [ "$RunningPids" ]; then echo "secure shell daemon already running." exit 0 fi if [ -x /usr/local/sbin/sshd ]; then echo "Starting the secure shell daemon." /usr/local/sbin/sshd fi ;; 'stop') if [ "$RunningPids" -a "$PidFilePid" -gt 0 ]; then echo "Stopping the secure shell daemon." kill $PidFildPid fi ;; 'reconfigure') if [ "$RunningPids" -a "$PidFilePid" -gt 0 ]; then echo "Reconfiguring the secure shell daemon." kill -HUP $PidFilePid fi ;; *) echo "Usage: sh $0 { start | stop | reconfigure }" ;; esac exit 0