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.

I have a server running CentOS, which I am configuring and I would like to have a java service startup automatically when the server is restarted how can I go about doing this?

The command to run the service is:

java -jar testing.jar

this is located in folder /sys/java/service.

Also being new to Linux how can I actually kill the service if I need to?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Put the command in /etc/rc.local

the best option would be running it as a dedicated user as in

su - username -c "java -jar /sys/java/service/testing.jar"

you can kill the service then with

pkill -u username java
share|improve this answer
    
Thanks for the quick response! Much appreciated. –  Dino Dec 9 '11 at 21:30
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.