summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-misc/openssh/files/sshd')
-rwxr-xr-xnet-misc/openssh/files/sshd44
1 files changed, 44 insertions, 0 deletions
diff --git a/net-misc/openssh/files/sshd b/net-misc/openssh/files/sshd
new file mode 100755
index 000000000000..a9427815d1a1
--- /dev/null
+++ b/net-misc/openssh/files/sshd
@@ -0,0 +1,44 @@
+#!/bin/sh
+#RCUPDATE:2 3 4:75:This line is required for script management
+
+. /etc/rc.d/config/functions
+
+SERVICE="Secure Shell"
+opts="start stop restart"
+
+PIDFILE=/var/run/sshd.pid
+EXE=/usr/sbin/sshd
+
+start() {
+
+ if [ ! -e /etc/ssh/ssh_host_key ] ; then
+ einfo "Generate Hostkey..."
+ /usr/bin/ssh-keygen -b 1024 -f /etc/ssh/ssh_host_key -N ''
+ fi
+
+ if [ ! -e /etc/ssh/ssh_host_dsa_key ] ; then
+ einfo "Generate DSA-Hostkey..."
+ /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N ''
+ fi
+
+ ebegin "Starting $SERVICE..."
+ start-stop-daemon --start --quiet --exec $EXE
+ eend $? "Started $SERVICE." "Error Starting $SERVICE."
+}
+
+stop() {
+ ebegin "Stopping $SERVICE..."
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $EXE
+ eend $? "Stopped $SERVICE." "Error Stopping $SERVICE."
+}
+
+restart() {
+
+ stop
+ start
+
+}
+
+doservice ${@}
+
+