Call to restart script from CGI not fully restarting

I'm trying to restart the Boa web server from inside a CGI script written in C. This is on a ucLinux system. The call to system("/etc/init.d/boa.sh restart") runs successfully and I see from the logs that Boa is stopped, but it is never started. Running boa.sh restart from the CLI does work OK. The boa.sh script is shown below. Any ideas as to why it's not fully restarting? Note that the CGI script itself is running within Boa.


NAME=boa
PROG=/bin/boa
OPTIONS="-c /etc/"
LOCKFILE=/var/lock/boa
STDLOGFILE=/var/log/boaerrlog.log

case "$1" in
    start)
        echo -n $"Starting $NAME: "
        boa $OPTIONS > /dev/null 2>&1 &
#       boa $OPTIONS >$STDOUTFILE 2>&1 &
        touch $LOCKFILE
        echo "OK"
        ;;
    stop)
        echo -n $"Stopping $NAME: "
        kill -TERM `pidof $NAME` > /dev/null 2>&1
        rm -f $LOCKFILE $PIDFILE > /dev/null 2>&1
        echo "OK"
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    status)
        echo "running"
        ;;
esac

Answers


Information gathered in a chat.

The process that is being restarted through the system call in the CGI is actually being served by the same process. This does not work as the term signal likely is killing all process in the tree including the restarted boa process.

An alternative is to have a second instance of boa running that can restart the production instance. While the production instance can restart the second instance used to restart the production instance.


Need Your Help

webgl video delay / store and access past frames

javascript video textures buffer webgl

I'd like to create a realtime video delay using webgl. Essentially I want to have a rolling buffer that would keep a certain number of past frames available for me to use within a shader.

Restore Database on Different Server

c# sql sql-server

I have backup (.bak) on one server and I want to restore the database on other server on Lan.. My concern is that when I run restore by connecting to remote sql server then it tries to find the .ba...