I exported an upstart script via foreman, and I added a line to the .conf file to send an email if the process was restarted. However, when ever I kill the process to test the functionality, it spams my inbox with over 20 emails. Does anyone know if there is a more efficient way of doing this, or am I SOL?
start on starting square-web
stop on stopping square-web
respawn
exec su - deployer -c 'cd /rails/square; echo "Thin 5000 restarted on square.local" | mail jordan@square.org; export PORT=5000; export RAILS_ENV=production; rails s thin -p $PORT >> /var/log/square/web-1.log 2>&1'