Skip to content

Instantly share code, notes, and snippets.

@vsbabu
Last active December 4, 2022 15:57
Show Gist options
  • Save vsbabu/c0ba2127be5dbe851e74c5326d5ff318 to your computer and use it in GitHub Desktop.
Save vsbabu/c0ba2127be5dbe851e74c5326d5ff318 to your computer and use it in GitHub Desktop.
Skeleton service file for SystemD (/etc/systemd/system/filename.service)
[Unit]
Description=Spring Boot My Application JVM
After=syslog.target
[Service]
User=myappuser
# send to /dev/null so that syslog doesn't get flooded
Environment='STDOUT=/dev/null'
# logback if any on stderr can be sent here; ensure myappuser has access
Environment='STDERR=/some/path/myapp/logs/stderr.log'
# ensure that you've logging.path defined in your config file springboot looks at
ExecStart=/bin/sh -c "/some/path/myapp.jar > ${STDOUT} 2> ${STDERR}"
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
Alias=myapp.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment