Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nuxero/7b1450aa84434a9705ef4bceb46e0f20 to your computer and use it in GitHub Desktop.
Save nuxero/7b1450aa84434a9705ef4bceb46e0f20 to your computer and use it in GitHub Desktop.
Systemd

Systemd

sample.service file you have to copy it to /etc/systemd/system

Set it to auto start

sudo systemctl enable sample.service

Troubleshoot

sudo journalctl -u sample.service
sudo journalctl -u sample.service -f # to tail it

full sample

[Unit]
Description=Sample Service process


[Service]
WorkingDirectory=/home/app/code

Environment=LANG=en_US.UTF-8
Environment=LC_ALL=en_US.UTF-8

User=app

ExecStart=/home/app/.rbenv/shims/bundle exec "rake sample:worker"

Restart=on-failure
TimeoutStartSec=90


[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment