1

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?

user9517
  • 115,471
  • 20
  • 215
  • 297
Dino
  • 47
  • 1
  • 3
  • 5

1 Answers1

2

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
golemwashere
  • 734
  • 1
  • 10
  • 22