Skip to content

Instantly share code, notes, and snippets.

@CarlosEspejo
Last active December 29, 2017 09:15
Show Gist options
  • Save CarlosEspejo/5371ab8aa4315bdf905c to your computer and use it in GitHub Desktop.
Save CarlosEspejo/5371ab8aa4315bdf905c 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
@CarlosEspejo
Copy link
Author

Update with the more options of journalctl like --since

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