Skip to content

Instantly share code, notes, and snippets.

@augustf
Created August 6, 2015 18:58
Show Gist options
  • Save augustf/9edcaec8ae9cc2ba4d87 to your computer and use it in GitHub Desktop.
Save augustf/9edcaec8ae9cc2ba4d87 to your computer and use it in GitHub Desktop.
systemd script for rails
# systemd unit file
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
# - systemctl enable rectifier_mailman
# - systemctl {start,stop,restart} rectifier_mailman
#
# See Inspeqtor's Systemd wiki page for more detail about Systemd:
# https://github.com/mperham/inspeqtor/wiki/Systemd
#
[Unit]
Description=rectifier_mailman
# start us only once the network and logging subsystems are available,
# consider adding redis-server.service if Redis is local and systemd-managed.
After=syslog.target network.target
# See these pages for lots of options:
# http://0pointer.de/public/systemd-man/systemd.service.html
# http://0pointer.de/public/systemd-man/systemd.exec.html
[Service]
Type=simple
WorkingDirectory=/var/rails/production/rectifier
ExecStart=/usr/local/bin/bundle exec script/mailman_server
User=www-data
Group=www-data
UMask=0002
# if we crash, restart
RestartSec=1
Restart=on-failure
# output goes to /var/log/syslog
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=rectifier_mailman
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment