Normally you'll want to run Squid as a daemon process (i.e., not attached to your terminal window). The easiest way to do this is simply execute Squid as follows:
% squid -s
The -s option causes Squid to write important status and warning messages to syslogd. Squid uses the LOCAL4 facility and the LOG_WARNING and LOG_NOTICE priorities. Your syslog daemon may or may not actually log Squid's messages, depending on how it is configured. These same messages are written to the cache.log file, so it is safe to omit the -s option if you prefer.
When you start Squid without the -N option (as shown earlier), Squid automatically backgrounds itself and creates a parent/child process pair. The child process is the one that does all the real work. The parent process makes sure that a child process is always running. Thus, if the child process dies unexpectedly, the parent starts another so that Squid remains in operation. You can see this parent/child process interaction by looking at your syslog messages:
Jul 31 14:58:35 zapp squid: Squid Parent: child process 296 started
Here you can see that the parent is process ID 294, and the child is 296. When you look at ps output, you'll see that the child process is listed as (squid):
% ps ax | grep squid 294 ?? Is 0:00.01 squid -sD 296 ?? S 0:00.27 (squid) -sD (squid)
If the child Squid process dies unexpectedly, the parent starts another. For example:
Jul 31 15:02:53 zapp squid: Squid Parent: child process 296 exited due to signal 6 Jul 31 15:02:56 zapp squid: Squid Parent: child process 359 started
In some situations, the child Squid process may die immediately. Rather than constantly spawning new Squid processes, the parent process gives up if the child processes won't stay running for at least 10 seconds five times in a row:
Jul 31 15:13:48 zapp squid: Squid Parent: child process 474 exited with status 1 Jul 31 15:13:48 zapp squid: Exiting due to repeated, frequent failures
If this happens to you, check syslog and Squid's cache.log for error messages.
When Squid runs as a daemon process, it looks for a file named squid_start in the same directory as the squid binary. If found, this program is executed before the parent process forks to run the child process. You can use this script for certain administrative tasks, such as notifying someone that Squid is starting, managing log files, etc. Squid doesn't start the child process until the squid_start program exits.