I'm using php processes to send emails in the background and I'm trying to find a way to auto-resume in case the server ever goes down or something happens to the script to make it stop.
My logic is: if the send session is still running but hasn't sent a new email in X time, kill the process if already running and start a new process.
Now, my problem lies with the "kill process if already running" part. How can I be sure this process with this PID is the same process I started for the send session? I can't check the name because I'm going to have several of them running at the same time. I don't want to kill a random process or another send process.
So the problem is: how can I uniquely identify a process running on linux? Or how can I mark it in some way to make it unique? Is there a way to maybe check its parameters from outside?