5.9 Reconfiguring a Running Squid Process
As you learn more about Squid, you'll probably
find yourself making many changes to the
squid.conf file. To have the new settings take
effect, you can either shut down and restart Squid, or you can
reconfigure Squid while it is running.
The best way to reconfigure a running Squid process is with the
squid -k reconfigure command:
% squid -k reconfigure
When you run this command, a HUP signal is sent to the running Squid
process. Squid then reads and parses the
squid.conf file. If the operation is successful,
you'll see this in cache.log:
2003/09/29 22:02:25| Restarting Squid Cache (version 2.5.STABLE4)...
2003/09/29 22:02:25| FD 12 Closing HTTP connection
2003/09/29 22:02:25| FD 13 Closing ICP connection
2003/09/29 22:02:25| Cache dir '/usr/local/squid/var/cache' size remains unchanged
at 102400 KB
2003/09/29 22:02:25| DNS Socket created on FD 5
2003/09/29 22:02:25| Adding nameserver 10.0.0.1 from /etc/resolv.conf
2003/09/29 22:02:25| Accepting HTTP connections at 0.0.0.0, port 3128, FD 9.
2003/09/29 22:02:25| Accepting ICP messages at 0.0.0.0, port 3130, FD 11.
2003/09/29 22:02:25| WCCP Disabled.
2003/09/29 22:02:25| Loaded Icons.
2003/09/29 22:02:25| Ready to serve requests.
You need to be a little careful with the
reconfigure option because it's
possible to make changes that cause a fatal error. For example, note
that Squid closes and reopens the incoming HTTP and ICP sockets. If
you change the http_port to a port number that
Squid can't open, it exits with a fatal error
message.
Certain options and directives can't be changed
while Squid is running. This includes:
Removal of cache directories (cache_dir
directive). Changes to the store_log directive. Changing the block-size value for
coss cache_dirs. In fact,
whenever you change this value, you must reinitialize the
coss cache_dir. The coredump_dir directive
isn't examined during the reconfigure procedure.
Thus, you can't make Squid change its current
directory after it has started.
Solaris users may experience a subtle problem when reconfiguring
Squid. The fopen( ) call in the Solaris
stdio implementation requires an unused file
descriptor less than 256. The FILE structure
stores the file descriptor as an 8-bit value. Normally this
isn't a problem because Squid uses raw I/O (e.g.,
open( )) to open cache files. However, certain
tasks that occur during the reconfigure procedure use
fopen( ). These may fail if the first 256 file
descriptors are already allocated.
|