blob: 5e91948997a464c29fa74fa7ab17045536f103a8 [file] [log] [blame]
Damien Miller06230761999-10-28 14:03:14 +10001#!/bin/bash
2
3# Init file for OpenSSH server daemon
4#
5# chkconfig: 2345 55 25
6# description: OpenSSH server daemon
7#
Damien Millera37010e1999-10-29 09:18:29 +10008# processname: sshd
9# config: /etc/ssh/ssh_host_key
10# config: /etc/ssh/ssh_host_key.pub
11# config: /etc/ssh/ssh_random_seed
12# config: /etc/ssh/sshd_config
13# pidfile: /var/run/sshd.pid
Damien Miller06230761999-10-28 14:03:14 +100014
15# source function library
16. /etc/rc.d/init.d/functions
17
18RETVAL=0
19
20case "$1" in
21 start)
Damien Millera37010e1999-10-29 09:18:29 +100022 echo -n "Starting sshd: "
Damien Miller192bd011999-11-13 23:56:35 +110023 if [ ! -f /var/run/sshd.pid ] ; then
24 /usr/sbin/sshd && success "sshd startup" || failure "sshd startup"
25 RETVAL=$?
26 fi
Damien Miller06230761999-10-28 14:03:14 +100027 echo
28 ;;
29 stop)
Damien Millera37010e1999-10-29 09:18:29 +100030 echo -n "Shutting down sshd: "
Damien Miller192bd011999-11-13 23:56:35 +110031 if [ -f /var/run/sshd.pid ] ; then
32 killproc sshd
33 fi
Damien Miller06230761999-10-28 14:03:14 +100034 echo
35 ;;
36 restart)
37 $0 stop
38 $0 start
39 RETVAL=$?
40 ;;
41 status)
Damien Millera37010e1999-10-29 09:18:29 +100042 status sshd
Damien Miller06230761999-10-28 14:03:14 +100043 RETVAL=$?
44 ;;
45 *)
Damien Millera37010e1999-10-29 09:18:29 +100046 echo "Usage: sshd {start|stop|restart|status}"
Damien Miller06230761999-10-28 14:03:14 +100047 exit 1
48esac
49
50exit $RETVAL