PageRenderTime 72ms CodeModel.GetById 68ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/network/if-up.d/openssh-server

http://github.com/brinkman83/bashrc
Shell | 37 lines | 20 code | 8 blank | 9 comment | 13 complexity | d6e8fb0f6192bc4cb91c4a1bc50d096b MD5 | raw file
 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
33# We'd like to use 'reload' here, but it has some problems; see #502444.
34stop ssh || true
35start ssh || true
36
37exit 0