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

django app creates auth.user and app user at same time and stores auth.user_id in app.user

django-admin django-forms django-views django-authentication

I have an app that adds a user to the system via auth.user and the app. On save I want to create the user and then get the and add that to a

Registry: find and replace part of a path in a batch file

batch-file replace registry

I need to find and replace a specific part of a value in any key below HKEY_current_user.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.