92b770cd82
Since there's not much point in generating missing host keys when the init script is called with "stop", the call to ssh-keygen should not be done inconditionally, but in the start function instead. Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
48 lines
532 B
Bash
48 lines
532 B
Bash
#!/bin/sh
|
|
#
|
|
# sshd Starts sshd.
|
|
#
|
|
|
|
# Make sure the ssh-keygen progam exists
|
|
[ -f /usr/bin/ssh-keygen ] || exit 0
|
|
|
|
umask 077
|
|
|
|
start() {
|
|
# Create any missing keys
|
|
/usr/bin/ssh-keygen -A
|
|
|
|
printf "Starting sshd: "
|
|
/usr/sbin/sshd
|
|
touch /var/lock/sshd
|
|
echo "OK"
|
|
}
|
|
stop() {
|
|
printf "Stopping sshd: "
|
|
killall sshd
|
|
rm -f /var/lock/sshd
|
|
echo "OK"
|
|
}
|
|
restart() {
|
|
stop
|
|
start
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
start
|
|
;;
|
|
stop)
|
|
stop
|
|
;;
|
|
restart|reload)
|
|
restart
|
|
;;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart}"
|
|
exit 1
|
|
esac
|
|
|
|
exit $?
|
|
|