#!/bin/sh
#
# chkconfig: 345 55 45
# description: sshd (secure shell daemon) is a server part of the ssh suite.
#	Ssh can be used for remote login, remote file copying, TCP port
#	forwarding etc. Ssh offers strong encryption and authentication.
#

# Source function library.
. /etc/rc.d/init.d/functions

# See how we were called.
case "$1" in
  start)
	echo -n "Starting sshd: "
	if test -r /var/run/sshd.pid && kill -0 `cat /var/run/sshd.pid`
	then echo "already running according to /var/run/sshd.pid. Not started."
	else /usr/sbin/sshd
		echo sshd
	fi
	touch /var/lock/subsys/sshd
	;;
  stop)
	echo -n "Stopping sshd: "
	[ -f /var/run/sshd.pid ] || exit 0
	kill -TERM `cat /var/run/sshd.pid`
	rm -f /var/run/sshd.pid
	rm -f /var/lock/subsys/sshd
	echo "sshd"
	;;
  restart)
	$0 stop
	$0 start
	;;
  status)
	status sshd
	;;
  *)
	echo "Usage: $0 {start|stop|restart|status}"
	exit 1
esac

exit 0

