madebyhiro / codem-transcode

Offline video transcoder written in node.js
Other
153 stars 68 forks source link

Init script with codem-transcode and CentOS 7 not working #45

Closed ProvostA closed 9 years ago

ProvostA commented 9 years ago

I installed codem-transcode on CentOS - 7 and the script " init.d " no longer works with this version of the system.

If i try to run this command:

runuser -l codem -c "/home/codem/node_modules/codem-transcode/bin/codem-transcode -c /home/codem/node_modules/codem-transcode/config/server-IP_3000.json"

It is working fine

Here is the script:

!/bin/sh

chkconfig: 35 99 99

description: Node.js /home/codem/node_modules/codem-transcode/bin

. /etc/rc.d/init.d/functions

USER="codem"

DAEMON="/home/codem/node_modules/codem-transcode/bin/codem-transcode" ROOT_DIR="/home/codem/node_modules/codem-transcode/bin"

SERVER="$ROOT_DIR/codem-transcode" LOG_FILE="/var/log/codem-transcode/codem-transcode.log"

LOCK_FILE="/var/lock/subsys/codem-transcode"

do_start() { if [ ! -f "$LOCK_FILE" ] ; then echo -n $"Starting $SERVER: " runuser -l "$USER" -c "$DAEMON $SERVER -c /home/codem/node_modules/codem-transcode/config/server-IP_3000.json

LOG_FILE &" && echo_success || echo_failure RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $LOCK_FILE else echo "$SERVER is locked." RETVAL=1 fi } do_stop() { echo -n $"Stopping $SERVER: " pid=ps -aefw | grep "$DAEMON $SERVER" | grep -v " grep " | awk '{print $2}' kill -9 $pid > /dev/null 2>&1 && echo_success || echo_failure RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE }

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

exit $RETVAL

tieleman commented 9 years ago

Thanks, @bartzon, maybe it's time to update the Codem packages with the latest software versions and latest OS releases?

bartzon commented 9 years ago

I've spent most of the day trying to get our Codem packages (https://github.com/madebyhiro/codem- install) to work, but I'm getting segfaults left and right. I'll definitely look into it, but I can't give an ETA.

@ProvostA, are you good to go as of now?

ProvostA commented 9 years ago

We installed it manually here but what is missing is the init script. Could you provide it?

bartzon commented 9 years ago

Which init script are you referring to?

The script to start the transcoder is a thin wrapper around /PATH/TO/TRANSCODER/bin/codem-transcode -c /PATH/TO/CONFIG/config.json. See https://github.com/madebyhiro/codem-transcode#configuration.

ProvostA commented 9 years ago

I'm talking about the init.d script in CentOs, look at the start of the thread for the details

bartzon commented 9 years ago

As far as I can see, the packages provided by codem-install do not contain an init.d script. Furthermore, codem-install would install the transcoder in /opt/codem-transcoder, not /home/codem.

I'm not entirely sure where the script you referred to is coming from, it doesn't look like it's provided by Codem. I'm afraid I can't help you with that, especially since I don't have access to CentOS at the moment.

ProvostA commented 9 years ago

Indeed this script is not part of CODEMs - install, but it is necessary to launch the start of a system such as CentOS.

Too bad you cannot help me.

Thank you anyway