This project is merged with Ant Media Server to make fast and easy development
Ant Media Server Service
Herein you will find the service / daemon portion of the project. We utilize the Apache Commons Daemon project for our service process on all supported platforms; currently Linux and Windows are supported.
Apache Daemon Windows binaries download
Daemon Details
To hook-in to the daemon, one would get an instance of the EngineLauncher
class and call the start()
method to start the server process and stop()
to terminate it. The windows implementation using procrun
is only slightly different in that it calls windowsService()
for both start and stop (The string start
must be supplied via args with windows).
Shutdown
The Server / service shutdown is performed via socket connection and the shutdown token must be supplied via args
when making the request; if its not supplied, the shutdown.token
file will be opened, if it exists and is readable.
Setup
Linux
Linux daemon uses jsvc and the init.d
script red5
.
- Set / export RED5_HOME environmental variable
- Edit the variables in the init.d script to match your server
- Install jsvc
- Debian
sudo apt-get install jsvc
- CentOS
sudo yum ??
- Copy the
red5
script to your init.d directory, ex./etc/init.d/
- This step is for Systemd enabled operating systems only such as CentOS 7. Copy the
red5.service
file into the/etc/systemd/system/
directory. Modify the file as needed, ensure theExecStart
path is correctly pointing to the init script. - Install the init.d script
- Debian
sudo update-rc.d red5 defaults
sudo update-rc.d red5 enable
- CentOS
systemctl daemon-reload
systemctl enable red5.service
- Start the service
- Debian
service red5 start
- CentOS
systemctl start red5.service
- Stop the service
- Debian
service red5 stop
- CentOs
systemctl stop red5.service
Windows
Windows daemon uses procrun (whose executable is named prunsrv.exe).
Install
- Set the RED5_HOME environmental variable (see below Managing Windows Environment Variables for more detail)
- Edit the variables in the
install-service.bat
script to match your server, ONLY if you have special requirements - Download the windows binaries
- The most current daemon archive (since 2013) to use is named:
commons-daemon-1.0.15-bin-windows.zip
- Unzip the daemon archive into your red5 directory
- Ensure
prunsrv.exe
is in your red5 home directory alongsidered5-service.jar
- Execute
install-service.bat
to install the service (See Install Errors below for resolutions, if you encounter an error) - Open the windows services panel
services.msc
- Scroll down to
Red5 Media Server
- Start the service by clicking the start button in the UI
- Stop the service by clicking the stop button in the UI
Install Errors If you have a JRE installed and have pointed JAVA_HOME at its location, you will see this error:
C:\red5>install-service.bat
Processor Architecture: "AMD64"
Using Daemon: "C:\red5\\amd64\prunsrv.exe"
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
To resolve this, remove the JAVA_HOME variable and create one for JRE_HOME. Now go back to step 6 and try again.
Uninstall
- To uninstall the service execute
uninstall-service.bat
Managing Windows Environment Variables
The RED5_HOME variable is used by Red5 and the service daemon; it is used to locate the Red5 installation. The variable must point to the Red5 install location, which may be C:\Program Files\Red5
or something similar depending on how you installed it.
System Variables
You must be an administrator to modify a system environment variable. System environment variables are defined by Windows and apply to all computer users. Changes to the system environment are written to the registry, and usually require a restart to become effective.
User Variables for User Name
Any user can add, modify, or remove a user environment variable. These variables are established by Windows Setup, by some programs, and by users. The changes are written to the registry, and are usually effective immediately. However, after a change to user environment variables is made, any open software programs should be restarted to force them to read the new registry values. The common reason to add variables is to provide data that is required for variables that you want to use in scripts.
To view or change environment variables:
- Right-click
My Computer
, and then clickProperties
. - If no
My Computer
exists (Windows 10), Right-click windows logo (Start button) and selectSystem
- Click the
Advanced
tab orAdvanced system settings
option - Click
Environment variables
. - Click one the following options, for either a user or a system variable:
- Click New to add a new variable name and value.
- Click an existing variable, and then click Edit to change its name or value.