#!/bin/bash # $Header: /root/magellan-cvs/src/openssh/sshd.rc,v 1.1 2005-07-02 17:07:55 niro Exp $ #%rlevels: 3:s 4:s 5:s 0:k 1:k 2:k 6:k #%start: 30 #%stop: 30 #deps #%needs: #%before: #%after: source /etc/sysconfig/rc source $rc_functions gen_keys() { if [ ! -e /etc/ssh/ssh_host_key ] then echo -e ${COLOREDSTAR}"Generating SSH-Hostkey ..." /usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N '' fi if [ ! -e /etc/ssh/ssh_host_dsa_key ] then echo -e ${COLREDSTAR}"Generating DSA-Hostkey ..." /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N '' fi if [ ! -e /etc/ssh/ssh_host_rsa_key ] then echo -e ${COLOREDSTAR}"Generating RSA-Hostkey ..." /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N '' fi } case "$1" in start) gen_keys echo -e ${COLOREDSTAR}"Starting SSH Server ..." start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid \ --startas /usr/sbin/sshd evaluate_retval update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; stop) echo -e ${COLOREDSTAR}"Stopping SSH Server ..." start-stop-daemon --stop --quiet --pidfile /var/run/sshd.pid evaluate_retval update_svcstatus $1 splash svc_stopped "$(basename $0)" 0 ;; reload) echo -e ${COLOREDSTAR}"Reloading SSH Server ..." reloadproc /usr/sbin/sshd ;; restart) $0 stop sleep 1 $0 start ;; status) statusproc /usr/sbin/sshd ;; *) echo "Usage: $0 {start|stop|reload|restart|status}" exit 1 ;; esac