Created
April 14, 2018 07:34
-
-
Save ilyaevseev/c0f364b99f8701c151b9a4b38e563b10 to your computer and use it in GitHub Desktop.
Check that Squid is crashed and restart it.
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/sh | |
Logger() { level="$1"; shift; logger -t "${0##*/}" -p "user.$level" -- "$@"; return 0; } | |
test -f "/var/run/squid/squid.pid" || exit 0 | |
pgrep -F "/var/run/squid/squid.pid" | grep -q '' && | |
Logger info "Squid OK" && | |
exit 0 | |
Logger err "Squid seems dead, try to restart..." | |
/usr/local/etc/rc.d/squid restart | |
test -f "/var/run/squid/squid.pid" && | |
pgrep -F "/var/run/squid/squid.pid" | grep -q '' && | |
Logger notice "Squid restarted." || | |
Logger err "Squid restart failed." | |
## END ## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment