Red5 / red5-server

Red5 Server core
Apache License 2.0
3.34k stars 982 forks source link

init script Centos 7.6 nginx #279

Closed mrEckendonk closed 5 years ago

mrEckendonk commented 5 years ago

Issue

On server reboot I can only start red5-server manual

Short description

My red5-server is installed in /opt/red-server I can only start on a server reboot with

cd /opt/red5-server/
./red5.sh &

It works, port 5080 opens and can see the page of the red5 server

But followed several guides to create a working init but non of the work

Environment

[X] Operating system and version: Centos 7.6 x64 on Centmin Mod [X] Java version: 11.0.4" 2019-07-16 LTS [X] Red5 version: 1.2.2

Expected behavior

working init script

Actual behavior

manual startup

mondain commented 5 years ago

@Eckybrazzz have a look at the CentOS setup here https://github.com/Red5/red5-service and see if that works for you.

mrEckendonk commented 5 years ago

@mondain Thanks, it helped at bit, but I still have to start it manual. Need to set configuration correct. Some paths in the script are wrong. Again, manual as in first post works fine


service red5 start
Path /opt/red5-server/red5
Starting the Red5 service...
/etc/init.d/red5: line 74: cd: /opt/red5-server/red5: Not a directory
Cannot find any VM in Java Home /usr/java/default/bin
ERROR: jsvc was unable to change directory to: /opt/red5-server/red5
The Red5 service has started.
Unable to redirect to /opt/red5-server/red5/log/red5-service.log
Unable to redirect to /opt/red5-server/red5/log/red5-error.log
Cannot find any VM in Java Home /usr/java/default/bin
Cannot locate JVM library file
``` #279 
mrEckendonk commented 5 years ago

Resolved..

#!/bin/sh

### BEGIN INIT INFO
# Provides:             red5
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Red5 server
### END INIT INFO

start() {
  cd /opt/red5-server && nohup ./red5.sh > /dev/null 2>&1 &
  echo 'Service started' >&2
}

stop() {
 cd /opt/red5-server && ./red5-shutdown.sh > /dev/null 2>&1 &
 echo 'Service stopped' >&2
}

case "$1" in
start)
    start
    ;;
stop)
    stop
;;
restart)
    stop
    start
    ;;
 *)
    echo "Usage: $0 {start|stop|restart}"
 esac