Skip to content

Instantly share code, notes, and snippets.

@CTimmerman
Last active December 30, 2015 09:52
Show Gist options
  • Save CTimmerman/8fc7f0fc374fc03e8d0f to your computer and use it in GitHub Desktop.
Save CTimmerman/8fc7f0fc374fc03e8d0f to your computer and use it in GitHub Desktop.
Simple upstart script
# Save as `/etc/init/webmon.conf` and start your daemon with `sudo service webmon restart`. Output is in `/var/log/upstart/webmon.log`
description "Website monitor"
start on (net-device-up IFACE!=lo) # Start when network is up.
respawn
respawn limit 2 120 # Respawn no more than twice in 120 seconds.
# adduser --home /home/webmon webmon
setuid webmon # Don't run as root.
setgid webmon
chdir /home/webmon # Find uploads etc relatively.
exec /home/webmon/webmon.py # Don't forget the #! and `chmod +x`.
@CTimmerman
Copy link
Author

If your Ubuntu 15 complains about a missing Upstart socket, you could replace systemd with sudo apt-get install upstart-sysv and reboot. More info: http://askubuntu.com/a/615086/42522

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