On 02/05/2013 05:09 AM, Silamael wrote: > I just noticed that the squid -z command seems to fork and the child is > creating the cache directories. The parent immediatly returns with exit > code 0. Is this behaviour intended?
Yes, it is. In old Squids, -z implied no-daemon mode. Then folks wanted to use SMP macros in their configurations, including their cache_dir lines. Those macros require SMP mode (each Squid kid gets its own set of macro values) so we removed that implication. IIRC, there was a bug report and/or a squid-dev thread discussing this choice and the alternatives. In other words, this change and its backward incompatibility were not accidental. Technically, it would be possible to revert -z to no-daemon mode if and only if there are no SMP macros (or similar SMP dependencies) in the configuration file, but there is currently no patch implementing that feature. FWIW, neither rock nor ufs-based cache_dirs themselves require daemon mode for initialization. However, if your cache_dirs use SMP macros for directory names (and most ufs-based cache_dirs do), then daemon mode is required. > There's a race for cases like: squid -z; squid If you want squid to block (i.e., prevent the parent process from exiting immediately), and your configuration allows cache_dir initialization without SMP, then start Squid in no-daemon mode using the -N command line option: squid -z -N If that does not work, please file a bug report. If your configuration does not allow blocking cache_dir initialization, then you need to adjust your startup script to wait for the Squid daemon to exit. HTH, Alex.