Skip to content

Instantly share code, notes, and snippets.

@didyhu
Last active May 22, 2019 01:29
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 didyhu/5b1c3698aebfe0339dabb2f88d7d9650 to your computer and use it in GitHub Desktop.
Save didyhu/5b1c3698aebfe0339dabb2f88d7d9650 to your computer and use it in GitHub Desktop.

Systemd service

sudo vi /etc/systemd/system/foo.service
#/etc/systemd/system/foo.service
[Unit]
Description=DESCRIPTION
After=network.target

[Service]
Environment=FOO=FOO
Environment=BAR=BAR
User=root
Group=root
ExecStart=path/to/exec args
Restart=on-failure
WorkingDirectory=/path/to/dir

[Install]
WantedBy=multi-user.target
sudo systemctl status foo

sudo journalctl -u foo

sudo journalctl --follow -u foo

sudo systemctl restart foo

sudo systemctl stop foo

sudo systemctl enable foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment