Re: shall squid be stopped in order to run "squid -z"
On 08/05/2017 10:59 AM, Rafael Akchurin wrote:
> The thing is we are building the UI for Squid within our ICAP project
> and now need to let the admin “re-initialize” the cache_dir.
> Shall the squid daemon be stopped while doing this?
> Or ideally, is it possible to pass the **new** directory path to “squid
> –z” and then make a change in the conf followed by “squid –k
> reconfigure” and erasing the old dir later (how later?).
The combination is neither ideal nor fully supported today IIRC. The
ideal would be just your second part -- change squid.conf and run "squid
The first part (i.e., a dedicated "squid -z" run concurrent with the
primary Squid instance) is not ideal for many reasons that I do not have
time to detail here (but you may be able to find some relevant
references by searching for -z in Bugzilla and squid-dev archives). We
need to start supporting cache_dir initialization dynamically, but
nobody is working on that difficult project right now AFAIK.
As for "how later?", a correct implementation should probably remove the
old cache_dir when it is no longer used by any process. That check is
going to be OS- and possibly fs-specific. Squid could also log a message
when it stops using a removed cache_dir, but I am not sure that polling
for such messages is a better approach -- what if Squid crashes before
emitting that message, for example?