Last active
September 2, 2021 10:17
-
-
Save arslan-gg/48fd1df0f6a8a7a8e554632c9066178b to your computer and use it in GitHub Desktop.
systemd service script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.