How to start the killed java process with its PID in Linux?
2 Answers
A process's PID is an ephemeral bit of information that has no bearing on the program itself. It is not possible to restart a dead process just by knowing its original PID. You need to know what the process was, as well as any environment variables and parameters, to restart it the way it was running.
Depending on how the process was killed, some of that information may be available in your logs. For example, if the kernel killed a process you can find the process's title information in the kernel log by checking dmesg
output or /var/log/kern.log
(exact file location varies).
You can't, unless you have more information.
The PID (process ID) is only active when the process is running. When the process is done, the PID is no longer in use.
Trivia:
If the process is still running and you wish to start the same executable, it is possible to execute /proc/PID/exe
, where PID
is the PID in question. This can be useful if you have a server running in screen and just upgraded the screen executable and can't reconnect without using the original screen executable.