-
-
Save vanderw/66943663c9209c8b39dea8ae53f73107 to your computer and use it in GitHub Desktop.
systemctl golang service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/lib/systemd/system/myservice.service | |
# | |
# systemctl daemon-reload | |
# systemctl enable myservice.service | |
# systemctl start myservice.service | |
# | |
[Unit] | |
Description=Service | |
ConditionPathExists=/path/to/web/folder | |
After=network.target | |
[Service] | |
Type=simple | |
User=myuser # make sure to do run $ loginctl enable-linger myuser | |
Group=mygroup | |
Restart=always | |
RestartSec=3 | |
WorkingDirectory=/path/to/web/folder | |
ExecStart=/path/to/web/folder/executable | |
Environment="YOUR_ENV_1=YOUR_ENV_1_VALUE" | |
Environment="YOUR_ENV_2=YOUR_ENV_2_VALUE" | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment