Created
May 26, 2022 10:34
-
-
Save fortitudepub/74c860329535ddfaf9a089c6bb107191 to your computer and use it in GitHub Desktop.
A simle dnsmasq status check and restart when needed because it might listen to tailscale IP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
logger -t "dnsmasqlivecheck" "dnsmasq live check run" | |
if [[ ! -f /run/dnsmasq/dnsmasq.pid ]]; then | |
logger -t "dnsmasqlivecheck" "dnsmasq pid not present, restart" | |
systemctl restart dnsmasq | |
exit 1 | |
fi | |
pid=`cat /run/dnsmasq/dnsmasq.pid` | |
if [[ ! -f /proc/$pid/cmdline ]]; then | |
logger -t "dnsmasqlivecheck" "dnsmasq pid is stale, restart" | |
systemctl restart dnsmasq | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment