Wednesday, July 27, 2022

[SOLVED] Trying to kill a nohup process that changes PIDs

Issue

I list the PID and then try to kill it using:

nohup server &
kill <PID>

However, I keep getting the error:

nohup: failed to run command ‘server’: No such file or directory

enter image description here

This is because the PID keeps changing! When I try to kill the current PID, the nohup process is suddenly another PID! Below is a screenshot of the process continually chainging PIDs.

enter image description here


Solution

I don't think you quite understand the error message.

nohup just launches another process (in your example called server), preventing it from getting a SIGHUP once the terminal starting it disconnects.

The problem here is not that the PID changes (the displayed pid is the pid of nohup when it temporarily launches), it's that nohup can't find a command called server to launch at all.

nohup: failed to run command ‘server’: No such file or directory



Answered By - Joachim Isaksson
Answer Checked By - Mildred Charles (WPSolving Admin)