[Pkg-utopia-maintainers] Bug#756547: Bug#756547: network-manager: Restarting NM with many connections breaks sshd via start rate limit

Vladimir K pzs-fs at yandex.ru
Sat Aug 2 07:50:01 UTC 2014


How about adding a blocking delay into if-up script?

========================
LOCK_FILE=/tmp/openssh-server-delay
# if lock file exists and is less than 1 second old, do nothing.
# else create a lock file, wait 1 second, remove lock file, restart
if [ -e "${LOCK_FILE}" ] && [ "$(( $(date +%s) - $(stat -c %Y "${LOCK_FILE}") ))" -lt "1" ]
then
	exit 0
else
	touch "${LOCK_FILE}"
	sleep 1s
	rm "${LOCK_FILE}"
	invoke-rc.d ssh restart >/dev/null 2>&1 || true
fi
========================
This way if there is a burst of restart requests within one second, restart would occur only once, with 1 second delay.



More information about the Pkg-utopia-maintainers mailing list