summaryrefslogtreecommitdiff
path: root/debian/init
diff options
context:
space:
mode:
Diffstat (limited to 'debian/init')
-rw-r--r--debian/init60
1 files changed, 60 insertions, 0 deletions
diff --git a/debian/init b/debian/init
new file mode 100644
index 000000000..fe59584e6
--- /dev/null
+++ b/debian/init
@@ -0,0 +1,60 @@
1#! /bin/sh
2
3# /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon
4
5test -x /usr/sbin/sshd || exit 0
6( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
7
8# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
9if [ -e /etc/ssh/sshd_not_to_be_run ]; then
10 echo "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
11 exit 0
12fi
13
14check_config() {
15 /usr/sbin/sshd -t || exit 1
16}
17
18# Configurable options:
19
20case "$1" in
21 start)
22 test -f /etc/ssh/sshd_not_to_be_run && exit 0
23#Create the PrivSep empty dir if necessary
24 if [ ! -d /var/run/sshd ]; then
25 mkdir /var/run/sshd; chmod 0755 /var/run/sshd
26 fi
27 echo -n "Starting OpenBSD Secure Shell server: sshd"
28 start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd
29 echo "."
30 ;;
31 stop)
32 echo -n "Stopping OpenBSD Secure Shell server: sshd"
33 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid
34 echo "."
35 ;;
36
37 reload|force-reload)
38 test -f /etc/ssh/sshd_not_to_be_run && exit 0
39 check_config
40 echo -n "Reloading OpenBSD Secure Shell server's configuration"
41 start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd
42 echo "."
43 ;;
44
45 restart)
46 test -f /etc/ssh/sshd_not_to_be_run && exit 0
47 check_config
48 echo -n "Restarting OpenBSD Secure Shell server: sshd"
49 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid
50 sleep 2
51 start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd
52 echo "."
53 ;;
54
55 *)
56 echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
57 exit 1
58esac
59
60exit 0