October 14, 2011

Reload Icecast configuration without disconnecting listeners and losing source

In order to make Icecast2 re-read config without restarting, i.e. losing source and disconnecting listeners, you'll have to send it the HUP signal. The icecast2 process will reload the configuration file icecast.xml and changes will take effect.

To send the HUP signal to a process you'll have to know it's PID. Basically, it looks like the following:
kill -HUP %PID%

So how do you know Icecast's PID? You'll have to either check the ps aux command output (i recommend you filter the output with | grep icecast): finding icecast pid with ps aux output
... or use the Icecast's .pid-file. Open up the icecast.xml file to edit Icecast configuration and under the <paths> section alter the <pidfile> setting. For example, the FreeBSD path would be:
<pidfile>/usr/local/share/icecast/icecast.pid</pidfile>

Restart Icecast. Now the .pid-file should be generated and available by the path specified. So no it's time to say Icecast SUP HUP:
kill -HUP `cat /usr/local/share/icecast/icecast.pid`

No comments: