Hi Cinaed, > The problem as I see it is there needs to be timeout (or a wait) between > stop and start in restart. > > The stop branch returns immediately and then executes the start branch > which sees the pid file (since the controlling squid is waiting for the > children to complete their processes) and claims squid already running > and exits. No, stop won't return immediately. It waits for the control process to stop, but it waits for a limited amount of time. So when stop returns to restart, squid may still be alive. That's why I propose using the stop function own return code on restart: if stop says it returned by timeout, restart shouldn't start. > So when the controlling squid finally stops and removes the pid file the > start branch has already exited and the server doesn't restart. > > I'm not an expert on squid but I would not recommend removing the pid > file before squid controller has exited. I guess the script removes the pid file because squid may have been killed without a change to clean after himself. Other CentOS init scripts do the same. []s, Fernando Lozano