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?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Stop child process when parent process stops
- Error building gcc 4.8.3 from source: libstdc++.so
- Program doesn’t terminate when using processes
If a nohup.out file was created, you may run in bash:
it will return the pid which created/is running the file
best regards!
ps auxwww|grep -i 'server'
should return all process which hasserver
in them. Otherwise, server may have already stopped.You should be able to determine the PID (and store it in a file) as follows:
There is no definitive way to catch the exact process with the help of
ps
command, but you can use the following: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.
The best way to launch a server in centos is with the service command.
So
service httpd start
There is a chance that you want to write your program as a daemon
See http://www.netzmafia.de/skripten/unix/linux-daemon-howto.html