Installation d'un service sous Linux
Exemple de configuration pour lancer un service sous Linux
1[Unit]
2Description=Mon service server daemon
3After=network.target
4
5[Service]
6#Type=simple
7#Type=exec
8Type=forking
9EnvironmentFile=/etc/sysconfig/monservice
10ExecStart=/usr/sbin/monservice
11#Restart= always
12User=monuser
13KillMode=process
14Environment=MON_SERVICE_HOME=/usr/share/monservice
15Environment=MON_SERVICE_CONF=/etc/monservice/conf
16Environment=LOCAL_JMX=false
17
18[Install]
19WantedBy=multi-user.target
Ensuite pour l'installer :
1# installer
2sudo cp curator/mon-service.service /etc/systemd/system/mon-service.service
3sudo systemctl enable mon-service.service
4sudo systemctl start mon-service.service
5# voir l'état
6sudo systemctl status mon-service.service
7# voir les logs
8journalctl -u mon-service.service
Pour la commande pour lancer le processus
1#!/bin/bash
2
3nohup java -jar /home/monservice/mon-service-webapp-1.0.0-SNAPSHOT.jar --spring.config.location=/home/monservice/config/application.yml > /dev/null 2>&1 &