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/ restart") runs successfully and I see from the logs that Boa is stopped, but it is never started. Running restart from the CLI does work OK. The script is shown below. Any ideas as to why it's not fully restarting? Note that the CGI script itself is running within Boa.

OPTIONS="-c /etc/"

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


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...