On 29/11/2015 11:32 a.m., Eliezer Croitoru wrote: > A check on what? > Basically to verify if squid is still running you need to verify that > there are is not one squid instance running. > The PID is kind of a hack to make sure squid is still there or not. > In most cases you can cancel the timeout and check only for the PID. > Also notice that there is a "rm -rf" there which was inherited from an > old script that I got as a "gift" since my own script got lost in a > server migration. > > You can run three checks in parallel: > - the pid exists or not > - the process exists or not(using "ps aux|grep squid") > - check if the port in netstat is still in listening mode. > Also, be aware the shutdown signal for squid is SIGHUP. If you need to abort the internal timeout use a second SIGHUP. So the shutdown process as seen/done by external scripts should be: * scan squid.conf for unusual pidfile_path and shutdown_lifetime values * if squid.pid exists; send SIGHUP to process indicated inside * else locate running squid process and send SIGHUP * wait desired timeout + a few seconds * if process still exists; repeat SIGHUP * wait a few seconds more * if process still exists; send SIGKILL; repeat until closed * if squid.pid still exists; rm squid.pid Notice the two points where waiting "a few seconds more" is needed for the signals to have effects. That is the time Squid *actually* takes to shutdown. The shutdown_lifetime is a grace period where normal proxying operations are still taking place to try and finish client transactions off. It is essentially the *minimum* time needed for Squid to shutdown. If you just abruptly abort/SIGKILL right at the same point where squid should only be starting to seriousy wind up its own internal actions it can lead cache and FD problems. HTH Amos _______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users