I do have the PID of the process to be killed but I do want to give it the chance to die peacefully, without doing a -9.
Expected behaviour: check if PID is still running for up to ten seconds and do a kill -9 on it.
Extra bonus if you could do this in a single line.
Best Answer
A better way to do this (that prevent killing the same PID for a different process) is:
The above method may fail on a heavy loaded system (that forks frequently)