updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / openssh-multihomed / sshd
blob875028a91cfb6521f5484c406df2fadbd99331a2
1 #!/bin/bash
3 . /etc/rc.conf
4 . /etc/rc.d/functions
5 . /etc/conf.d/sshd
7 PID=`cat /var/run/sshd.pid 2>/dev/null`
8 case "$1" in
9 start)
10 stat_busy "Starting Secure Shell Daemon"
11 [ -f /etc/ssh/ssh_host_key ] || { /usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key >/dev/null; }
12 [ -f /etc/ssh/ssh_host_rsa_key ] || { /usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key >/dev/null; }
13 [ -f /etc/ssh/ssh_host_dsa_key ] || { /usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key >/dev/null; }
14 [ -z "$PID" ] && /usr/sbin/sshd $SSHD_ARGS
15 if [ $? -gt 0 ]; then
16 stat_fail
17 else
18 add_daemon sshd
19 stat_done
22 stop)
23 stat_busy "Stopping Secure Shell Daemon"
24 [ ! -z "$PID" ] && kill $PID &> /dev/null
25 if [ $? -gt 0 ]; then
26 stat_fail
27 else
28 rm_daemon sshd
29 stat_done
32 restart)
33 $0 stop
34 sleep 1
35 $0 start
38 echo "usage: $0 {start|stop|restart}"
39 esac
40 exit 0