View Single Post

  #2 (permalink)  
Old 06-10-2008, 04:48 PM
unSpawn unSpawn is offline
Junior Member
User
 
Join Date: Feb 2008
My distro: .
Posts: 10
Rep Power: 0
unSpawn is on a distinguished road
Default

If you want to script this yourself you could check the PID file Squid uses when it runs, check if it exists and if it does cat it and save the PID to a variable. Then notice the full commandline Squid runs as, use that in pgrep -f 'commandline' and save the PID( to an array. Check if the array is empty ("${#array[@]}"), else compare PIDs. If empty or PIDs not matching up, stop Squid gracefully, remove the PID file then start Squid.
OTOH running a dedicated process watcher like Monit is easy to configure and expand, faster in checking and more versatile as it can start, restart about any service and alert you all in one go and all of the time.
Reply With Quote