Mercurial > vanilla
view network/openssh/sshd @ 586:1218a8f753b6
core/busybox: let's re-add /etc/inittab support
While busybox has weird /etc/inittab support the predefined actions without it
are too minimalistic so re-add the support for it but don't install an
/etc/inittab file.
The file /etc/inittab file is still installed with sysvinit but if someone wants
to use busybox's init it should create its own /etc/inittab file with the
busybox syntax and do not install sysvinit afterwards.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 08 Jul 2019 20:35:00 +0200 |
parents | 9f90de3d806f |
children | 657ee4987f4d |
line wrap: on
line source
#!/bin/sh # # /etc/rc.d/sshd: run control script for sshd if [ -f /etc/rc.conf ]; then . /etc/rc.conf fi : ${SSHD_CMD:=/bin/sshd} : ${SSHD_ARGS:=} : ${SSHD_PID:=/var/run/sshd.pid} sshd_start() { if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then /bin/ssh-keygen -q -t rsa -b 2048 -N "" -f /etc/ssh/ssh_host_rsa_key fi if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then /bin/ssh-keygen -q -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key fi if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then /bin/ssh-keygen -q -t ecdsa -b 521 -N "" -f /etc/ssh/ssh_host_ecdsa_key fi if [ ! -f /etc/ssh/ssh_host_ed25519_key ]; then /bin/ssh-keygen -q -t ed25519 -N "" -f /etc/ssh/ssh_host_ed25519_key fi echo "Starting sshd: $SSHD_CMD $SSHD_ARGS" $SSHD_CMD $SSHD_ARGS -p $SSHD_PID } sshd_status() { if [ -s $SSHD_PID ]; then echo "sshd is running with pid: `cat $SSHD_PID`" else echo "sshd is not running" fi } sshd_stop() { if [ -s $SSHD_PID ]; then echo "Stopping sshd." kill -QUIT $SSHD_PID fi } sshd_restart() { sshd_stop sleep 3 sshd_start } case $1 in start) sshd_start ;; status) sshd_status ;; stop) sshd_stop ;; restart) sshd_restart ;; *) echo "usage: $(basename $0) restart|start|status|stop" ;; esac