I run a server executable in Centos using the following command "nohup server &"
. Now I need to kill the process "server"
. But I tried "ps -a"
command to get the PID
but I couldnt get the process. Now how to kill the "server"
now?
nohup. out file will be in location of your present working directory ,pwd. (the directory from where you executed command).
To run a nohup command in the background, add an & (ampersand) to the end of the command. If the standard error is displayed on the terminal and if the standard output is neither displayed on the terminal, nor sent to the output file specified by the user (the default output file is nohup. out), both the ./nohup.
Nohup, short for no hang up is a command in Linux systems that keep processes running even after exiting the shell or terminal. Nohup prevents the processes or jobs from receiving the SIGHUP (Signal Hang UP) signal. This is a signal that is sent to a process upon closing or exiting the terminal.
Ending the nohup command with an & makes the command run in the background, even after you exit the shell. To exit the shell in this situation, enter the exit command. nohup ensures that the command does not end when the creating process ends.
There is no definitive way to catch the exact process with the help of ps
command, but you can use the following:
ps -a | grep "server"
You will get a list of all the processes running with the name "server"
Or, you can use any other keywords as well to grep the ps output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With