The Icecast Streaming Media Server is popular software for distributing live audio streams online. All configuration is stored as an XML file. If you have multiple servers, it is convenient to centrally store and update this configuration.
I’ve written a simple shell script to automatically download the configuration from Amazon Web Services’ S3, check it for changes, and gracefully reload Icecast if changes are found.
Here’s the shell script:
This script assumes:
- You are using a Debian-based Linux distribution (e.g. Ubuntu)
- Your configuration file in S3 is called “icecast.xml”
- The local configuration file is “/etc/icecast2/icecast.xml”
- You have OpenSSL and cURL installed
It’s recommended this script be installed in a home directory on your Linux server, and run it regularly via Crontab.
If there have been no changes to the XML file, it doesn’t bother reloading Icecast.
I use this script to manage a cluster of Icecast servers. We use multiple servers in a DNS Round-Robin to give us provider diversity, geographic diversity, and scalability. If we see an increase in listeners, we can easily add an additional server. Likewise, if there’s an issue with a specific server it can easily be removed from the cluster.