欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

init script process pid not working red5 dead but pid file exists" can someone help me about that!

So I have red5 streaming server installed and can get it to launch and stay launched when closing ssh terminal window using the following init.d script code:

#!/bin/bash
# For RedHat and cousins:
# chkconfig: 2345 85 85
# description: Red5 flash streaming server
# processname: red5
# Created By: Sohail Riaz (sohaileo@gmail.com)

PROG=red5
RED5_HOME=/usr/local/red5
DAEMON=$RED5_HOME/$PROG.sh
PIDFILE=/var/run/$PROG.pid

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

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

RETVAL=0

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

exit $RETVAL

So I can just type 'red5 start', 'red5 status' and 'red5 stop'.

Now I renamed the red5 folder to red5bak and have been testing a new updated version in a new 'red5' folder which also uses a red5.sh file to launch. I can launch this manually no problem and works as intended however when launched with the above commands and code it says started 'OK' but appears not to and when using 'status' command I get the error red5 dead but pid file exists.

I tried deleting the pid red5 files in var/run and lock folders and restarting server but still get the same issue.

If I delete the newer red5 folder and rename the old folder back then the script works again so how can I get it to work for the newer version/files?

Any help would be appreciated,

Thanks.

shareimprove this questionasked Jul 26 '14 at 2:09nrider551210

The file is listed in your init script at the top:

PROG=red5
PIDFILE=/var/run/$PROG.pid

So try deleting it (as root user):

rm /var/run/red5.pid
shareimprove this answeranswered Jul 27 '14 at 8:18Alexander Farber6,89448170306

   As I said above I had already deleted the pid file in that directory. It appears a pid file is created in that folder only when the original working red5 folder/script is run but once the script is stopped the pid file appears to delete itself from the var/run folder. Which is strange that when trying with the new red5 folder and previous script, it says that the process is dead but the 'pid file exists' when from what I can tell it doesn't. – nrider Jul 29 '14 at 0:39

来自  http://shipingzhong.cn/node-admin/11077



普通分类: