in reply to Signals and END block
Your question is really ´How can I know a process is running and get
information about it?´. For this question a database is a poor solution.
A still poorer solution is a PID-File. The best solution would be a FIFO, aka named pipe. Because every process closes its filedescriptors at the end of its run (even if SIGKILLED) and a FIFO behaves different if
its open by another process, you can surely detect if a process is running. Steps to take:
Exclusively gain access to the FIFO(done with another FIFO)
Stat FIFO: if empty no process
Open FIFO
Read FIFO
Write back to FIFO
Close FIFO
Give up exclusive access
The Server does only:Exclusively gain access to the FIFO(done with another FIFO)Open FIFOWrite PID to FIFO
Not close FIFOGive up exclusive access