Skip to content

Instantly share code, notes, and snippets.

@soumik-dutta
Last active May 15, 2019 02:53
Show Gist options
  • Save soumik-dutta/1e738d2626477a884ce170d54e9077da to your computer and use it in GitHub Desktop.
Save soumik-dutta/1e738d2626477a884ce170d54e9077da to your computer and use it in GitHub Desktop.
Creating services in unix

Creating service in unix

  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment