diff options
author | jlam <jlam> | 2000-07-24 16:44:52 +0000 |
---|---|---|
committer | jlam <jlam> | 2000-07-24 16:44:52 +0000 |
commit | 4edda79a7c169e45dfb680d5a7a6d1e4958c06db (patch) | |
tree | dae7b5afaa8bab3ae23ce01c833a7661912e52dd /security/ssh | |
parent | 650a51fdd6e5892d3ce7c6ad86f581d215499bf5 (diff) | |
download | pkgsrc-4edda79a7c169e45dfb680d5a7a6d1e4958c06db.tar.gz |
Make all the installed /usr/pkg/etc/rc.d/sshd.sh files match.
Also default to "start" command if run with no arguments.
Diffstat (limited to 'security/ssh')
-rw-r--r-- | security/ssh/files/sshd.sh | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/security/ssh/files/sshd.sh b/security/ssh/files/sshd.sh index 7f89964346e..da23c72b8bd 100644 --- a/security/ssh/files/sshd.sh +++ b/security/ssh/files/sshd.sh @@ -1,14 +1,50 @@ #!/bin/sh # -# $NetBSD: sshd.sh,v 1.2 1999/06/20 19:47:31 kim Exp $ +# $NetBSD: sshd.sh,v 1.3 2000/07/24 16:44:53 jlam Exp $ # -if [ ! -f @SSH_CONF_DIR@/ssh_host_key ] -then - @PREFIX@/bin/ssh-keygen -f @SSH_CONF_DIR@/ssh_host_key -N '' -fi -if [ -x @PREFIX@/sbin/sshd -a -f @SSH_CONF_DIR@/sshd_config ] -then - @PREFIX@/sbin/sshd - echo -n ' sshd' -fi + +name="sshd" +pidfile="/var/run/${name}.pid" + +command=${1:-start} + +case ${command} in +start) + if [ ! -f @SSH_CONF_DIR@/ssh_host_key ] + then + @PREFIX@/bin/ssh-keygen -b 1024 -N "" -f /etc/ssh_host_key + fi + if [ ! -f @SSH_CONF_DIR@/ssh_host_dsa_key ] + then + /usr/pkg/bin/ssh-keygen -d -N "" -f /etc/ssh_host_dsa_key + fi + if [ -x @PREFIX@/sbin/sshd -a -f @SSH_CONF_DIR@/sshd_config ] + then + echo "Starting ${name}." + @PREFIX@/sbin/sshd + fi + ;; +stop) + if [ -f ${pidfile} ]; then + pid=`head -1 ${pidfile}` + echo "Stopping ${name}." + kill -TERM ${pid} + else + echo "${name} not running?" + fi + ;; +restart) + ( $0 stop ) + sleep 1 + $0 start + ;; +status) + if [ -f ${pidfile} ]; then + pid=`head -1 ${pidfile}` + echo "${name} is running as pid ${pid}." + else + echo "${name} is not running." + fi + ;; +esac exit 0 |