Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In order to run a game server (minecraft) I start it by running this command in CentOS:

java -Xms512M -Xmx1G -jar minecraft_server.jar

But I have no idea how to stop this file from running. I assume it has it's own internal command but considering it might be started in background and running for a very long time, how can I stop this Java command?

Thank you.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can use a combination of ps and kill to stop the particular process.

You would first do ps -aux | grep minecraft to get the process number - which is the second field, first number.

Then you can issue kill $PID to send SIGTERM to the process and have it gracefully shutdown.

share|improve this answer
    
deleting mine, yours looks nicer (yes, I know about a non drastic kill, was just being quick). –  mdpc Dec 18 '12 at 20:41
    
Then check, and if that doesn't stop the process then enter kill -9 $PID. –  mdpc Dec 18 '12 at 20:42
    
That does the job. Thank you. –  adrianTNT Dec 19 '12 at 19:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.