Skip to content

Instantly share code, notes, and snippets.

@ankibalyan
Created June 20, 2017 17:01
Show Gist options
  • Save ankibalyan/c038f74759e8b26369a1faef551c7a1b to your computer and use it in GitHub Desktop.
Save ankibalyan/c038f74759e8b26369a1faef551c7a1b to your computer and use it in GitHub Desktop.
Upstart service for ubuntu that starts automatically on system restarts, and restarts on failure
#! /etc/systemd/system/name.service
[Unit]
Description==describe you upstart service
# if mysql service is prerequisite
Requires=mysql.service
After=mysql.service
# if anyother service is prerequisite
Requires=anyother.service
After=anyother.service
[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/node /path/to/your/file
Restart=on-failure
RestartSec=10s
Type=notify
NotifyAccess=all
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment