Skip to content

Instantly share code, notes, and snippets.

@frozonfreak
Created August 14, 2015 01:24
Show Gist options
  • Save frozonfreak/e3621775a3c47dade212 to your computer and use it in GitHub Desktop.
Save frozonfreak/e3621775a3c47dade212 to your computer and use it in GitHub Desktop.
PHP daemon Ubuntu
# Info
description "My PHP Worker"
author "Jonathan"
# Events
start on startup
stop on shutdown
# Automatically respawn
respawn
respawn limit 20 5
# Run the script!
# Note, in this example, if your PHP script returns
# the string "ERROR", the daemon will stop itself.
script
[ $(exec /usr/bin/php -f /path/to/your/script.php) = 'ERROR' ] && ( stop; exit 1; )
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment