#!/bin/bash # # Init file for PlanetLab OpenSSH server daemon (copied from standard # sshd init file, minor modifications made). # # chkconfig: 2345 56 25 # description: PlanetLab OpenSSH server daemon # # processname: sshd # config: /etc/ssh/ssh_host_key # config: /etc/ssh/ssh_host_key.pub # config: /etc/ssh/ssh_random_seed # config: /etc/ssh/sshd_config # pidfile: /var/run/pl_sshd.pid # source function library . /etc/rc.d/init.d/functions # pull in sysconfig settings [ -f /etc/sysconfig/pl_sshd ] && . /etc/sysconfig/pl_sshd RETVAL=0 prog="pl_sshd" # Some functions to make the below more readable SSHD=/usr/local/sbin/pl_sshd PID_FILE=/var/run/pl_sshd.pid do_restart_sanity_check() { $SSHD -t RETVAL=$? if [ ! "$RETVAL" = 0 ]; then failure $"Configuration file or keys are invalid" echo fi } start() { echo -n $"Starting $prog:" #initlog -c "$SSHD $OPTIONS" && success || failure $SSHD $OPTIONS && success || failure RETVAL=$? [ "$RETVAL" = 0 ] && touch /var/lock/subsys/pl_sshd echo } stop() { echo -n $"Stopping $prog:" killproc $prog -TERM RETVAL=$? [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/pl_sshd echo } reload() { echo -n $"Reloading $prog:" killproc $prog -HUP RETVAL=$? echo } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; reload) reload ;; condrestart) if [ -f /var/lock/subsys/pl_sshd ] ; then do_restart_sanity_check if [ "$RETVAL" = 0 ] ; then stop # avoid race sleep 3 start fi fi ;; status) status pl_sshd RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" RETVAL=1 esac exit $RETVAL