Implantando app Standalone como Serviço
2
2. Conteúdo de exemplo do arquivo de serviço
[Unit]
Description=FishFacts
After=network.target
[Service]
Type=simple
Restart=always
WorkingDirectory=/var/www/webapp
ExecStart=/var/www/webapp/fishfacts
ExecStop=/usr/bin/curl --max-time 10 http://127.0.0.1:8077/?action=terminate
ExecStop=/bin/sleep 5
[Install]
WantedBy=multi-user.target7
7. Verifique o status do serviço
service fishfacts status● fishfacts.service - FishFacts
Loaded: loaded (/etc/systemd/system/fishfacts.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2020-11-0218:52:03 CET;1h 19min ago
Main PID:512(fishfacts)
Tasks:7(limit:4657)
Memory:32.5M
CGroup:/system.slice/fishfacts.service
└─512/var/www/webapp/fishfacts
Nov 0218:52:03 vm.server.net systemd[1]: Started FishFacts.