Last active
December 30, 2015 09:52
-
-
Save CTimmerman/8fc7f0fc374fc03e8d0f to your computer and use it in GitHub Desktop.
Simple upstart 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
# 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`. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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