Hi, I am doing a web-based viewer to read messages sent from a daemon on separate server.
I have a listener script that opens a socket, repeatedly waits for messages to come in and then write to a log file.
I have also a viewer script that reads from the log file and displays the messages on the browser.
I want to allow the user to control the uptime of the listener script. My current idea is to let the user make a cgi request to start the listener script, get the pid and put into a file. When the user make a request to stop listening, the cgi script will read from the file and kill the listener process using the pid.
I intend to try this next Monday but I'm not even sure the cgi script is allowed to kill a process this way.
Can anyone with experience give me some advice or a better approach to doing this?
Currently,the user has to make a request to check for updated logged messages. Is that a way to have the viewer script auto-update the web-page whenever the log file is updated by the listener script? If so, the viewer script also needs to know when the viewer closes the browser window so that it will exit itself right?