Hello everybody ! Probably some of you are wondering if there’s a way to make Red5 start automatically after a server reboot. Yes there is. Here’s how to autostart Red5:

  • log in as root in your server
  • once logged in, type these commands:
cd /etc/init.d/
touch red5
chmod 777 red5
  • you just created a configuration file for Red5
  • now, you have to edit this file. If you’re using a FTP client as Filezilla or TotalCommander, go to /etc/init.d/ folder and search for red5 fie
  • edit it with a text editor
  • paste inside the script below
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5


# Source function library
. /etc/rc.d/init.d/functions

[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5


case "$1" in
echo -n $"Starting $PROG: "
$DAEMON >/dev/null 2>/dev/null &
if [ $RETVAL -eq 0 ]; then
echo $! > $PIDFILE
touch /var/lock/subsys/$PROG
[ $RETVAL -eq 0 ] && success $"$PROG startup" || failure $"$PROG startup"
echo -n $"Shutting down $PROG: "
killproc -p $PIDFILE
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
$0 stop
$0 start
status $PROG -p $PIDFILE
echo $"Usage: $0 {start|stop|restart|status}"

exit $RETVAL
Then, add a red5 user using this command:
useradd red5

And use like:

service red5 start
service red5 stop
service red5 restart

Note: In this script, you have to make sure that the path to Red5 is the same as your installation folder. Some of you maybe have the Red5 installed in /usr/local/red5. Just edit this line, otherwise the script won’t find the red5 service to start.


Also, you might want to make Red5 start after the server reboots.

To do that, you need to do some chkconfig magic. First we need to add the RED5 service to chkconfig:

chkconfig --add red5

Now you need to tell chkconfig that red5 should start after booting:

chkconfig red5 on

You can edit the red5 file in the root console with the vi command:

  • vi /etc/init.d/red5
  • paste the script inside
  • edit the path to red5 (just in case)
  • press “esc” key, then “:wq!” (this is the way to save when editing with vi command)

Tech support will always be there to assist you with any issue !

4 thoughts on “How to Start Red5 Automatically

  1. steward says:

    This is useful.
    Suggest you include a link to this post when you complete a red5 installation.

    The other thing I’d like to see officially addressed is a cron job to clean the logs. Or a log rotation configuration. Not sure yet. Something that needs to be done, or the server will eventually croak 😉

    And of course permissions and ownerships are essential. Not sure why avchat installs as root, and I gather from this post it may be we can change ownership to something a little more sane. Not sure yet.

    Finally it would be nice to have a clear reason to choose one or the other of the two supported red5 versions. Or a least the information that might be used to make that decision.

    Glad to find this post, thank you for the information.

    1. alin says:

      Thank you for the heads up!
      We’re always pleased to help (our customers first) in special configuration cases as not everyone has tech knowledge.

      Regarding>”Not sure why avchat installs as root” – it’s not AVChat which requires root access, it’s Red5 only.
      AVChat can be installed on a shared web hosting account.

      Your suggestion regarding a cron job cleaning the logs is nice, we will consider it for future posts/tutorials.

      Regarding a difference between the 2 compatible versions of Red5, anyone can read the change log for both. There are several features added and bug fixes in newer versions, for example, h.264 encoding support (which allows creating .mp4 video files) added in Red5 1.0 RC1. Here’s an archive of changes made in Red5 during development:

      Download links (Linux distributions only):
      Red5 0.8 – http://red5.org/downloads/red5/0_8/red5-0.8.0.tar.gz
      Red5 1.0 RC1 – http://www.red5.org/downloads/red5/1_0/red5-1.0.0-RC1.tar.gz

  2. Hector says:

    If the code above for the /etc/init.d/red5 file is copied as is to either notepad, or to a Linux host (such as copy / past using PuTTY), all the open and close quotes will be transposed to periods, and of course the resulting script will not work.

    Be SURE to change all occurrences of the right & left double quotes (eg: “ ” ) in Alin’s script above to VERTICAL double quotes (eg: ” ) which are ASCII decimal number 34 / hex 22.

    Other than that, great. Works perfectly.

    1. alin says:

      Thank you for your observation, that’s right, I did not noticed those quotes before.
      I have edited the post and fixed the snippet.

      We appreciate your involvement.

Leave a Reply

Your email address will not be published. Required fields are marked *