Event Script Structure
Overview
Event scripts may be written in any programming language supported by your server; Centova Cast simply executes the script as an executable file and reads the output, so it is unconcerned with the implementation details.
Filename and Location
Event scripts are always executed on the stream hosting server. If you only run a single Centova Cast server, this implementation detail is irrelevant, however if you use a single web interface to control multiple Centova Cast stream hosting servers, you must ensure that the event scripts are created on the hosting servers, not the web interface server.
To implement a script for a particular event, create a file
in /usr/local/centovacast/var/events/
called eventname.sh
, where eventname is the name of
the event. A list of available event names, and their parameters, is provided in the
Event Reference section of the event scripts documentation.
For example, for the pre-reload event, you would create a script named
/usr/local/centovacast/var/events/pre-reload.sh
.
Implementation
As noted above, the event script's implementation details are left to the developer to decide. Centova Cast only requires that the file be a valid executable file, be it a script or a binary application.
Some events (noted in the Event Reference) require the script to pass a return value to back to Centova Cast. These scripts must pass the return value as the last line of output.
Valid return values include 1
, indicating success, 0
, indicating failure, or a text string,
representing an error message which will be displayed in the web interface or server logs. Any
return value other than success will result in Centova Cast aborting the operation it was
attempting to perform.
Event notification scripts will be executed under the user ID of the Centova Cast daemon account,
which is ccuser
by default. As such, the scripts will have access to the stream accounts'
configuration files and media, but will NOT have root privileges.