문제

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

도움이 되었습니까?

해결책

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

다른 팁

Your process is not continually changing PIDs, you're repeatedly starting the process and it's getting a new PID each time.

nohup server &

Starts the program nohup and tells it to launch server. When nohup can't find server, it prints the error message you see and quits, hence the

Exit 127    nohup server

messages you keep seeing.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top