archive: etc/fstab: adjust to fit well in 80 columns
[dragora.git] / archive / openssh / rc.main
blob5961cc5acd4dff3b52521be63b38589ea9c82d73
1 #! /bin/sh -
3 # sshd/rc.main
5 # The OpenSSH SSH daemon.
8 # Redirects the standard error to the standard output
9 exec 2>&1
11 TARGET="$1"
12 SVNAME="${2:-sshd}"
14 make_keys()
16 if test ! -f /etc/ssh/ssh_host_key || test ! -s /etc/ssh/ssh_host_key
17 then
18 echo "*** ${SVNAME}: Generating /etc/ssh/ssh_host_key ..."
19 /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ''
21 if test ! -f /etc/ssh/ssh_host_dsa_key || test ! -s /etc/ssh/ssh_host_dsa_key
22 then
23 echo "*** ${SVNAME}: Generating /etc/ssh/ssh_host_dsa_key ..."
24 /usr/bin/ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''
26 if test ! -f /etc/ssh/ssh_host_rsa_key || test ! -s /etc/ssh/ssh_host_rsa_key
27 then
28 echo "*** ${SVNAME}: Generating /etc/ssh/ssh_host_rsa_key ..."
29 /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
33 start()
35 echo "*** ${SVNAME}: Starting sshd ..."
36 make_keys
37 # sshd options required for perp service:
38 # -D no detach, run in foreground
39 # -e log to stderr (for tinylog) instead of syslog
41 exec /usr/sbin/sshd -D -e -f /etc/ssh/sshd_config
44 reset()
46 case $3 in
47 exit)
48 echo "*** ${SVNAME}: Exited status $4"
50 signal)
51 echo "*** ${SVNAME}: Killed on signal $5"
54 echo "*** ${SVNAME}: Stopped (${3})"
56 esac
59 # Branch to target
60 eval ${TARGET} "$@"