PServer Startup Scripts and AJAX issue.
CLIENT SIDE: I have an AJAX script that activates a DirectAdmin plugin which starts or stops the Palace Server. The AJAX script awaits a response and displays the status of the Palace Server, whether the server is started or stopped.
SERVER SIDE: I have a DirectAdmin plugin with the Palace Server start-plugin and stop-palace scripts merged. The plugin starts or stops the Palace Server based on the existence of the pserver.pid file.
THE ISSUE: The script works perfect when stopping the Palace Server, it stops the server and returns status to the AJAX script, which in turn displays the server has been stopped. When you start the palace server, the server starts, but the status does not display.
The AJAX script receives the status, but you have to manually refresh the page to display the status.
THOUGHTS: My thought is the status hangs between the server and client sides as a result of when the Palace Server is backgrounded. I am drawing the conclusion based on running 'ps' for the user who is running the Palace server, which displays the plugin as <defunct>(PID, TTY, TIME are not actual, just for illustration purposes):
PID TTY TIME CMD
12345 ? 12:34:56 start-stop.raw<defunct>
23456 ? 23:45:67 pserver
34567 ? 34:56:78 psfront
45678 ? 45:67:89 psfront
QUESTION: Is there anything else in the start/stop script that could be causing the response to hang; if so how do I resolve it? Or is it a result of the script backgrounding the pserver and placing an echo statement (the response) afterwards.
I can post the code if needed. Any thoughts or help are greatly appreciated; thanks in advance.
|