Skip to content

Instantly share code, notes, and snippets.

@Niemi
Last active February 10, 2023 07:40
Show Gist options
  • Save Niemi/7c8c326c35885d461ce0272e1d96fb68 to your computer and use it in GitHub Desktop.
Save Niemi/7c8c326c35885d461ce0272e1d96fb68 to your computer and use it in GitHub Desktop.
Sytemd service spring boot app
[Unit]
Description=Java App
Requires=network.target
After=syslog.target
[Service]
User=tomcat
Group=tomcat
#EnvironmentFile=/etc/profile.d/java
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -Xss256k -Xmx128m -Xms128m -XX:MaxDirectMemorySize=128m'
ExecStart=/usr/bin/java -jar /home/app/app.jar
WorkingDirectory=/home/app
SuccessExitStatus=143
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=simple
OOMScoreAdjust=-900
LimitNOFILE=16384
LimitNPROC=16384
LimitAS=infinity
LimitRSS=infinity
LimitCORE=infinity
RestartSec=30
[Install]
WantedBy=multi-user.target
Alias=javajar.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment