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: " |
Damien Miller | 192bd01 | 1999-11-13 23:56:35 +1100 | [diff] [blame^] | 23 | if [ ! -f /var/run/sshd.pid ] ; then |
| 24 | /usr/sbin/sshd && success "sshd startup" || failure "sshd startup" |
| 25 | RETVAL=$? |
| 26 | fi |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 27 | echo |
| 28 | ;; |
| 29 | stop) |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 30 | echo -n "Shutting down sshd: " |
Damien Miller | 192bd01 | 1999-11-13 23:56:35 +1100 | [diff] [blame^] | 31 | if [ -f /var/run/sshd.pid ] ; then |
| 32 | killproc sshd |
| 33 | fi |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 34 | echo |
| 35 | ;; |
| 36 | restart) |
| 37 | $0 stop |
| 38 | $0 start |
| 39 | RETVAL=$? |
| 40 | ;; |
| 41 | status) |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 42 | status sshd |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 43 | RETVAL=$? |
| 44 | ;; |
| 45 | *) |
Damien Miller | a37010e | 1999-10-29 09:18:29 +1000 | [diff] [blame] | 46 | echo "Usage: sshd {start|stop|restart|status}" |
Damien Miller | 0623076 | 1999-10-28 14:03:14 +1000 | [diff] [blame] | 47 | exit 1 |
| 48 | esac |
| 49 | |
| 50 | exit $RETVAL |