#!/bin/sh ######################################################################## # Begin sshd # # Description : Start sshd daemon # # Author : Bruce Dubbs - bdubbs@linuxfromscratch.org # # Version : BLFS 7.0 # ######################################################################## ### BEGIN INIT INFO # Provides: sshd # Required-Start: $network # Should-Start: networkmanager wicd krb5 openldap samba # Required-Stop: $network # Should-Stop: networkmanager wicd krb5 openldap samba # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Starts sshd daemon. # Description: Starts sshd daemon. # X-LFS-Provided-By: BLFS ### END INIT INFO . /lib/lsb/init-functions case "$1" in start) log_info_msg "Starting SSH Server..." start_daemon -f /usr/sbin/sshd evaluate_retval # Also prevent ssh from being killed by out of memory conditions sleep 1 pid=`cat /run/sshd.pid 2>/dev/null` echo "-16" >/proc/${pid}/oom_score_adj ;; stop) log_info_msg "Stopping SSH Server..." killproc -p "/run/sshd.pid" /usr/sbin/sshd evaluate_retval ;; reload) log_info_msg "Reloading SSH Server..." pid=`cat /run/sshd.pid 2>/dev/null` if [ -n "${pid}" ]; then kill -HUP "${pid}" else (exit 1) fi evaluate_retval ;; restart) $0 stop sleep 1 $0 start ;; status) statusproc /usr/sbin/sshd ;; *) echo "Usage: $0 {start|stop|reload|restart|status}" exit 1 ;; esac # End sshd bootscript