Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

1.1K
Vistas
Start a jar file like service in linux

I want to start and stop my jar file as follows

service myService start

service myService stop

my current jar file running as follows

cd /home/alex/IdeaProjects/myService
java -jar target/myService-SNAPSHOT-1.jar server config.yml

What should I do?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

You need a Service Wrapper to run the Jar file.

There are examples and instructions for init.d here. or for systemd (ubuntu 16+) here

over 4 years ago · Santiago Trujillo Denunciar

0

I prefer a light weight, free, bash script rather than a more elaborate system that requires licensing.

http://gustavostraube.wordpress.com/2009/11/05/writing-an-init-script-for-a-java-application/

Running jar as a Linux service - init.d script gets stuck starting app

https://askubuntu.com/questions/99232/how-to-make-a-jar-file-run-on-startup-and-when-you-log-out

over 4 years ago · Santiago Trujillo Denunciar

0

If you want to try the DIY way, you can place a startup script in your /etc/init.d directory as said here.

http://www.ghacks.net/2009/04/04/get-to-know-linux-the-etcinitd-directory/

However, to implement a clean yourScript stop command, I would recommend that you split your functionality into a launcher and a daemon, and make your launcher able to start or communicate with your existing daemon in order to send orders to it. Then your startup script would only invoke your launcher, which in its turn would start a new daemon, or send orders to the existing one.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda