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.


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to