Chapter 8. Displaying state of running servers

Both the proxy (pproxy) and the server (pserv) save their state and some configuration information in a shared memory mapped file. This file can be read at any time to find out about the current connections at their state, some counters and other information.

The state information can be found in the files /var/run/popular/pproxy.state and /var/run/popular/pserv.state, respectively.

The format of the files is in binary and defined in the C structs shmem_proxy and shmem_server. The first 8 chars contain the magic "POPULAR\0", the second 8 chars the magic "PROXY\0\0\0" or "SERVER\0\0", respectively. Following this is an integer with the version number (currently 1).

The pstatus command is supplied for reading both the pproxy and pserv state files. It will check the magic at the beginning of the file to find the type of file and then dump its contents to stdout. See the documentation for the pstatus command for an explanation of the dumped information.

If you want to "freeze" the current status information, just copy the file to a temporary file and redirect the pstatus command to read this file.

Note: There is currently no locking on the status file. This will not affect the correct function of the proxy and server, but it might lead to wrong data displayed by the pstatus command. This will be fixed at some point.