Skip to content

Instantly share code, notes, and snippets.

@Clivern
Created October 16, 2017 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Clivern/4d2d3200ba44f0dafcd834a4268cf9d8 to your computer and use it in GitHub Desktop.
Save Clivern/4d2d3200ba44f0dafcd834a4268cf9d8 to your computer and use it in GitHub Desktop.
Systemd For Java Project

Add Service File

sudo nano /etc/systemd/system/racter.service

Add Service Configs

[Unit]
Description=Racter Service
After=syslog.target
[Service]
WorkingDirectory=/root/www/racter/
SyslogIdentifier=Racter
ExecStart=/bin/bash -c "java -jar /root/www/racter/examples/sparkjava/build/libs/racter_sparkjava_example_fat-1.0.0.jar"
User=root
Type=simple
[Install]
WantedBy=multi-user.target

Reload Daemon

systemctl daemon-reload

Start Service

systemctl start racter.service

Get Service Status

systemctl status racter.service

Stop Service

systemctl stop racter.service

For More Info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment