sudo nano /etc/systemd/system/my_app.serviceThe content of my_app.service file:
[Unit]
Description=Springboot app for BLABLA (test-env)
After=syslog.target network.target
[Service]
User=aissam
Environment=MY_APP_PORT=2003
Environment=MY_APP_SECRET_KEY=blablablablablablablabla
Environment=MY_APP_DB_PASSWORD=blablabla
ExecStart=/usr/bin/java -cp '/home/aissam/springboot_app/dep1.jar:/home/aissam/springboot_app/dep2.jar:/home/aissam/springboot_app/my_app.jar' org.springframework.boot.loader.launch.JarLauncher
ExecStop=/bin/kill -15 $MAINPID
SuccessExitStatus=143
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reloadsudo systemctl start my_appsudo systemctl status my_appsudo journalctl -u my_app -fsudo systemctl enable my_app
# to disable it : sudo systemctl disable my_appsudo systemctl stop my_app