I am using UPSTART to restart my executable if by any chance it goes down and it works fine.start on runlevel [2345]stop on runlevel [016]chdir /opt/data/data_serverrespawnpost-stop script  sleep 30end scriptlimit nofile 8092 8092setuid davidexec ./data_server --file=../config/property.init --data_port=8080Is there any way we can add another feature which is to send out an email (as my program went down and going to be restarted) if my executable goes down and then restart it in the same UPSTART config? I am not sure whether there is any way to do that using the same UPSTART config.I want to send an email from abc@host.com to pqr@host.com with a simple message that my program went down at this time and also as soon as my program is restarted then I want to send another email that my program got restarted at this time.
How to send an email using UPSTART if my executable gets restarted?
linux;ubuntu;upstart
You could try something like this:start on runlevel [2345]stop on runlevel [016]chdir /opt/data/data_serverrespawnpost-start script    echo Service Started at `date +%F %T` on `hostname` | mail -s Service Started pqr@host.comend scriptpost-stop script  sleep 30end scriptlimit nofile 8092 8092setuid davidexec ./data_server --file=../config/property.init --data_port=8080The hostname command in the echo will print the server's hostname so you should be able to tell in the email what server it was restarted on.