summaryrefslogtreecommitdiff
path: root/debian/openssh-server.if-up.in
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2012-11-26 16:25:31 +0000
committerColin Watson <cjwatson@debian.org>2012-11-26 16:25:31 +0000
commit7a429f23d389f21d7f98737e6f641442c794226e (patch)
tree081c82baf752290222b4347ef462b4cc9338b9d6 /debian/openssh-server.if-up.in
parent5095210e1b6b15e1430b99bcb914645cde299329 (diff)
Merge Upstart job scripting support from Ubuntu, to handle the Upstart job being primary there.
Diffstat (limited to 'debian/openssh-server.if-up.in')
-rw-r--r--debian/openssh-server.if-up.in51
1 files changed, 51 insertions, 0 deletions
diff --git a/debian/openssh-server.if-up.in b/debian/openssh-server.if-up.in
new file mode 100644
index 000000000..871493068
--- /dev/null
+++ b/debian/openssh-server.if-up.in
@@ -0,0 +1,51 @@
1#! /bin/sh
2# Reload the OpenSSH server when an interface comes up, to allow it to start
3# listening on new addresses.
4
5set -e
6
7# Don't bother to restart sshd when lo is configured.
8if [ "$IFACE" = lo ]; then
9 exit 0
10fi
11
12# Only run from ifup.
13if [ "$MODE" != start ]; then
14 exit 0
15fi
16
17# OpenSSH only cares about inet and inet6. Get ye gone, strange people
18# still using ipx.
19if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != inet6 ]; then
20 exit 0
21fi
22
23# Is /usr mounted?
24if [ ! -e /usr/sbin/sshd ]; then
25 exit 0
26fi
27
28if [ ! -f /var/run/sshd.pid ] || \
29 [ "$(ps -p "$(cat /var/run/sshd.pid)" -o comm=)" != sshd ]; then
30 exit 0
31fi
32
33case '@DISTRIBUTOR@' in
34 Ubuntu)
35 # Both init script and Upstart job are present; we want to operate
36 # on the Upstart job.
37 stop ssh || true
38 start ssh || true
39 ;;
40 *)
41 # We'd like to use 'reload' here, but it has some problems; see
42 # #502444.
43 if [ -x /usr/sbin/invoke-rc.d ]; then
44 invoke-rc.d ssh restart >/dev/null 2>&1 || true
45 else
46 /etc/init.d/ssh restart >/dev/null 2>&1 || true
47 fi
48 ;;
49esac
50
51exit 0