diff options
Diffstat (limited to 'debian/openssh-server.ssh.init.in')
-rw-r--r-- | debian/openssh-server.ssh.init.in | 171 |
1 files changed, 0 insertions, 171 deletions
diff --git a/debian/openssh-server.ssh.init.in b/debian/openssh-server.ssh.init.in deleted file mode 100644 index e24cb1bed..000000000 --- a/debian/openssh-server.ssh.init.in +++ /dev/null | |||
@@ -1,171 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | |||
3 | ### BEGIN INIT INFO | ||
4 | # Provides: sshd | ||
5 | # Required-Start: $remote_fs $syslog | ||
6 | # Required-Stop: $remote_fs $syslog | ||
7 | # Default-Start: 2 3 4 5 | ||
8 | # Default-Stop: | ||
9 | # Short-Description: OpenBSD Secure Shell server | ||
10 | ### END INIT INFO | ||
11 | |||
12 | set -e | ||
13 | |||
14 | # /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon | ||
15 | |||
16 | test -x /usr/sbin/sshd || exit 0 | ||
17 | ( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0 | ||
18 | |||
19 | case '@DISTRIBUTOR@' in | ||
20 | Ubuntu) | ||
21 | # The init.d script is only for chroots. | ||
22 | if [ -e /etc/init/ssh.conf ] && ! ischroot; then | ||
23 | exec /lib/init/upstart-job ssh "$@" | ||
24 | fi | ||
25 | ;; | ||
26 | esac | ||
27 | |||
28 | umask 022 | ||
29 | |||
30 | if test -f /etc/default/ssh; then | ||
31 | . /etc/default/ssh | ||
32 | fi | ||
33 | |||
34 | . /lib/lsb/init-functions | ||
35 | |||
36 | if [ -n "$2" ]; then | ||
37 | SSHD_OPTS="$SSHD_OPTS $2" | ||
38 | fi | ||
39 | |||
40 | # Are we running from init? | ||
41 | run_by_init() { | ||
42 | ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ] | ||
43 | } | ||
44 | |||
45 | check_for_no_start() { | ||
46 | # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists | ||
47 | if [ -e /etc/ssh/sshd_not_to_be_run ]; then | ||
48 | if [ "$1" = log_end_msg ]; then | ||
49 | log_end_msg 0 || true | ||
50 | fi | ||
51 | if ! run_by_init; then | ||
52 | log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)" || true | ||
53 | fi | ||
54 | exit 0 | ||
55 | fi | ||
56 | } | ||
57 | |||
58 | check_dev_null() { | ||
59 | if [ ! -c /dev/null ]; then | ||
60 | if [ "$1" = log_end_msg ]; then | ||
61 | log_end_msg 1 || true | ||
62 | fi | ||
63 | if ! run_by_init; then | ||
64 | log_action_msg "/dev/null is not a character device!" || true | ||
65 | fi | ||
66 | exit 1 | ||
67 | fi | ||
68 | } | ||
69 | |||
70 | check_privsep_dir() { | ||
71 | # Create the PrivSep empty dir if necessary | ||
72 | if [ ! -d /var/run/sshd ]; then | ||
73 | mkdir /var/run/sshd | ||
74 | chmod 0755 /var/run/sshd | ||
75 | fi | ||
76 | } | ||
77 | |||
78 | check_config() { | ||
79 | if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then | ||
80 | /usr/sbin/sshd $SSHD_OPTS -t || exit 1 | ||
81 | fi | ||
82 | } | ||
83 | |||
84 | export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" | ||
85 | |||
86 | case "$1" in | ||
87 | start) | ||
88 | check_privsep_dir | ||
89 | check_for_no_start | ||
90 | check_dev_null | ||
91 | log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true | ||
92 | if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then | ||
93 | log_end_msg 0 || true | ||
94 | else | ||
95 | log_end_msg 1 || true | ||
96 | fi | ||
97 | ;; | ||
98 | stop) | ||
99 | log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd" || true | ||
100 | if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then | ||
101 | log_end_msg 0 || true | ||
102 | else | ||
103 | log_end_msg 1 || true | ||
104 | fi | ||
105 | ;; | ||
106 | |||
107 | reload|force-reload) | ||
108 | check_for_no_start | ||
109 | check_config | ||
110 | log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd" || true | ||
111 | if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd; then | ||
112 | log_end_msg 0 || true | ||
113 | else | ||
114 | log_end_msg 1 || true | ||
115 | fi | ||
116 | ;; | ||
117 | |||
118 | restart) | ||
119 | check_privsep_dir | ||
120 | check_config | ||
121 | log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true | ||
122 | start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid | ||
123 | check_for_no_start log_end_msg | ||
124 | check_dev_null log_end_msg | ||
125 | if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then | ||
126 | log_end_msg 0 || true | ||
127 | else | ||
128 | log_end_msg 1 || true | ||
129 | fi | ||
130 | ;; | ||
131 | |||
132 | try-restart) | ||
133 | check_privsep_dir | ||
134 | check_config | ||
135 | log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true | ||
136 | RET=0 | ||
137 | start-stop-daemon --stop --quiet --retry 30 --pidfile /var/run/sshd.pid || RET="$?" | ||
138 | case $RET in | ||
139 | 0) | ||
140 | # old daemon stopped | ||
141 | check_for_no_start log_end_msg | ||
142 | check_dev_null log_end_msg | ||
143 | if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then | ||
144 | log_end_msg 0 || true | ||
145 | else | ||
146 | log_end_msg 1 || true | ||
147 | fi | ||
148 | ;; | ||
149 | 1) | ||
150 | # daemon not running | ||
151 | log_progress_msg "(not running)" || true | ||
152 | log_end_msg 0 || true | ||
153 | ;; | ||
154 | *) | ||
155 | # failed to stop | ||
156 | log_progress_msg "(failed to stop)" || true | ||
157 | log_end_msg 1 || true | ||
158 | ;; | ||
159 | esac | ||
160 | ;; | ||
161 | |||
162 | status) | ||
163 | status_of_proc -p /var/run/sshd.pid /usr/sbin/sshd sshd && exit 0 || exit $? | ||
164 | ;; | ||
165 | |||
166 | *) | ||
167 | log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart|status}" || true | ||
168 | exit 1 | ||
169 | esac | ||
170 | |||
171 | exit 0 | ||