Skip to content

Instantly share code, notes, and snippets.

@arslan-gg
Last active September 2, 2021 10:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arslan-gg/48fd1df0f6a8a7a8e554632c9066178b to your computer and use it in GitHub Desktop.
Save arslan-gg/48fd1df0f6a8a7a8e554632c9066178b to your computer and use it in GitHub Desktop.
systemd service script
# service configuration example
[Unit]
Description=AppName
Requires=network.target
[Service]
Type=simple
User=your_user_name
Group=your_user_group
WorkingDirectory=/path/to/your_app
ExecStart=/bin/bash -lc 'bundle exec rails server -e production --bind 0.0.0.0 --port 80'
TimeoutSec=60s
RestartSec=30s
Restart=always
[Install]
WantedBy=multi-user.target
@arslan-gg
Copy link
Author

Store file in: /etc/systemd/system/app_name.service
After it call: systemctl daemon-reload
Enable service: systemctl enable app_name.service
Start service: systemctl start app_name.service
Use journalctl for debugging.

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