Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Init file for OpenSSH server daemon |
| 4 | # |
| 5 | # chkconfig: 2345 55 25 |
| 6 | # description: OpenSSH server daemon |
| 7 | # |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 8 | # 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 Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 14 | |
| 15 | # source function library |
| 16 | . /etc/rc.d/init.d/functions |
| 17 | |
| 18 | RETVAL=0 |
| 19 | |
| 20 | case "$1" in |
| 21 | start) |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 22 | echo -n "Starting sshd: " |
| 23 | daemon /usr/sbin/sshd |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 24 | RETVAL=$? |
| 25 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/sshd |
| 26 | echo |
| 27 | ;; |
| 28 | stop) |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 29 | echo -n "Shutting down sshd: " |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 30 | killproc sshd |
| 31 | RETVAL=$? |
| 32 | [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/sshd |
| 33 | echo |
| 34 | ;; |
| 35 | restart) |
| 36 | $0 stop |
| 37 | $0 start |
| 38 | RETVAL=$? |
| 39 | ;; |
| 40 | status) |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 41 | status sshd |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 42 | RETVAL=$? |
| 43 | ;; |
| 44 | *) |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 45 | echo "Usage: sshd {start|stop|restart|status}" |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 46 | exit 1 |
| 47 | esac |
| 48 | |
| 49 | exit $RETVAL |