Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active November 30, 2021 17:41
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 dacr/14b2b754ce41e57b0a0d44b5917e1cc4 to your computer and use it in GitHub Desktop.
Save dacr/14b2b754ce41e57b0a0d44b5917e1cc4 to your computer and use it in GitHub Desktop.
Simple way to create a systemd service with a blocking command / published by https://github.com/dacr/code-examples-manager #ced76171-53bc-4d99-bc22-9b36a3bc0657/e5002527399dcc0de774841e89e6c61aeb4d6065
## summary : Simple way to create a systemd service with a blocking command
## keywords : systemd, simple, service
## publish : gist
## authors : David Crosson
## license : none
## id : ced76171-53bc-4d99-bc22-9b36a3bc0657
## created-on : 2020-07-18T13:24:58Z
## managed-by : https://github.com/dacr/code-examples-manager
# - Place the file into `/etc/systemd/system/` directory
# - Requires this instruction for any changes to be take into account by systemd
# - `systemctl daemon-reload`
# - `systemctl enable SomeService`
# - `systemctl start SomeService`
[Unit]
Description=SomeService
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=simple
WorkingDirectory=/somewhere
ExecStart=/somewhere/bin/someBlockingCommand
Environment=VAR1=VAL1
Environment=VAR2=VAL2
Restart=on-failure
LimitNOFILE=10000
User=auser
Group=users
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment