aboutsummaryrefslogtreecommitdiff
path: root/src/openssh/sshd-close-sessions
blob: 4291cc16f18b493e0ab81f414a4a1a6cb1ce4149 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Close sshd sessions before shutting down the network; see FS#17389.

sshd_close_sessions () {
	if ck_daemon sshd; then
		return
	fi
	/etc/rc.d/sshd stop
	stat_busy "Stopping Secure Shell Sessions"
	for i in $(pgrep sshd); do
		if readlink -q /proc/$i/exe | grep -q '^/usr/bin/sshd'; then
			kill $i
		fi
	done &>/dev/null
	stat_done
}

add_hook shutdown_start sshd_close_sessions