Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My upstart config looks something like this

start on filesystem
stop on runlevel S


exec /path/to/my/script

When this script dies and is respawned I would like to receive an email. Is this possible, or am I using the wrong tool for the job?


share|improve this question

2 Answers 2

You could write a post-start stanza to send e-mail(s).

# An Upstart script to manage the foo service

post-start script
    echo "my-foo service started at `date +"%F %T.%N"`" | mail -s "My-foo Service Started" me@mydomain.org
    echo "my-foo service started at `date +"%F %T"`" | mail -s "My-foo Service Started" them@theirdomain.org
end script

exec -u foo-user /usr/local/bin/foo
share|improve this answer

You could add a mail command inside your script or write a wrapper script that does that and then calls your script. Then you'd have Upstart use your wrapper script.

echo 'Script scriptname respawned' | mail -s "respawn notice" foo@example.com
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.