Systemd Service Templates
For more information about systemd, please refer to the Wikipedia page.
* Modify these templates according to your configuration before starting the services!
Download Templates
GitFlic Service
curl -O "https://gitflic.ru/project/kovalevaa/utils/blob/raw?file=systemd/gitflic.service"
GitFlic Runner Agent
curl -O "https://gitflic.ru/project/kovalevaa/utils/blob/raw?file=systemd/gfagent.service"
GitFlic Service
gitflic.service
[Unit]
Description=GitFlic Application Service
Documentation=https://docs.gitflic.ru/
After=network.target
[Service]
Type=simple
User=gitflic
Group=gitflic
WorkingDirectory=/opt/gitflic/
ExecStart=/usr/bin/java -jar /opt/gitflic/bin/gitflic.jar --spring.config.additional-location=file:/etc/gitflic/
ExecStop=/bin/kill -s 15 $MAINPID
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.target
GitFlic Runner Agent
gfagent.service
[Unit]
Description=GitFlic Runner Agent
After=gitflic.service
Requires=gitflic.service
[Service]
User=gitflic-agent
Group=gitflic-agent
WorkingDirectory=/home/gitflic-agent/gitflic-runner
ExecStart=/usr/bin/java -jar runner.jar start --config=config/application.properties
ExecStop=/bin/kill -s 15 $MAINPID
StandardOutput=journal
StandardError=journal
Restart=on-failure
RestartSec=10
TimeoutStartSec=2min
[Install]
WantedBy=multi-user.target
Systemd Unit Files Overview
Systemd unit files are typically located in three directories:
/usr/lib/systemd/system/ - Units installed via package managers (RPM/DEB)
/run/systemd/system/ - Runtime-generated units
/etc/systemd/system/ - Administrator-created units
[Unit] Section
Description - Service description
After - Specifies services that should start before this one
Requires - Hard dependency on other services
Wants - Soft dependency on other services
Documentation - Service documentation reference
[Service] Section
Type - Service type (simple, forking, etc.)
WorkingDirectory - Execution working directory
User - Service account username
Group - Service account group
Environment - Environment variables
ExecStart - Startup command
ExecStop - Shutdown command
Restart - Service restart policy
RestartSec - Delay before restart (seconds)
StandardOutput - STDOUT redirection
StandardError - STDERR redirection
TimeoutStartSec - Startup timeout
[Install] Section
WantedBy - Target that wants this service
Automatic translation!
This page has been automatically translated. The text may contain inaccuracies.