blob: 64adb37da1164f8a1324fa58e65dda34ae6f4c13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/sh
#RCUPDATE:2 3 4:75:This line is required for script management
. /etc/rc.d/config/functions
. /etc/rc.d/config/basic
SERVICE="OpenSSH"
opts="start stop restart"
PIDFILE=/var/run/sshd.pid
EXE=/usr/sbin/sshd
gen_keys() {
if [ ! -e /etc/ssh/ssh_host_key ] ; then
einfo "Generating 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 "Generating DSA-Hostkey..."
/usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N ''
fi
}
start() {
gen_keys
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 ${@}
|