I have an upstart script for the bitcoind, it based on the script in this topic: https://bitcointalk.org/index.php?topic=25518.0
I strongly need respawn future working: if something happened bitcoind should restart automatically. I tryed to emulate such situation, but upstart didn't restart the process.
Question: how can I make upstart (or something else) watch bitcoind and restart it if something bad happened?
Actual script:
description "bitcoind"
start on filesystem
stop on runlevel [!2345]
oom never
expect daemon
respawn
respawn limit 10 60 # 10 times in 60 seconds
script
user=root
home=/root/.bitcoin/
cmd=/usr/bin/bitcoind
pidfile=$home/bitcoind.pid
# Don't change anything below here unless you know what you're doing
[[ -e $pidfile && ! -d "/proc/$(cat $pidfile)" ]] && rm $pidfile
[[ -e $pidfile && "$(cat /proc/$(cat $pidfile)/cmdline)" != $cmd* ]] && rm $pidfile
exec start-stop-daemon --start -c $user --chdir $home --pidfile $pidfile --startas $cmd -b -m
end script