- Navigate to '/usr/lib/systemd/system/' and create a file test.service
- Edit the file accordingly
[Unit]
Description= Test hello world application
[Service]
ExecStart=/usr/bin/java -jar -Xms768M -Xmx1024M /root/jars/hello-world.jar
User=root
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.targe
- Enable the service that was just created by using the following command
systemctl enable test.service
- Restart the deamon
systemctl daemon-reload