Upstart mail script

Asked by Mariano González on 2014-01-27

Hi there.

I'm trying to configure an Upstart script to send me an e-mail alert when a process is respawned.

I've tried post and pre-start, exec and post and pre-stop scripts. No one seems to be working.

Here's an example:

/etc/init/ntpd.conf

### ntpd

script

mail -s "ntpd Service Respawned" <email address hidden>
control + D

end script

respawn

exec /etc/init.d/ntpd start

Once I kill the process (kill -9) the message.log will tell me it's being respawned but no clues about the script:
init: ntpd main process (12446) killed by KILL signal
init: ntpd main process ended, respawning

Any ideas or suggestions??
Thanks!!

Question information

Language:
English Edit question
Status:
Solved
For:
upstart Edit question
Assignee:
No assignee Edit question
Solved by:
Mariano González
Solved:
2014-01-30
Last query:
2014-01-30
Last reply:

CentOS 6.x

Applied this script and got it working:

respawn

pre-start script

mail -s "ntpd Service Respawned" <email address hidden>
control + D

end script

exec /etc/init.d/ntpd start

Thanks!