Automatically restart bitcoind on crash On Ubuntu 14.04 I have not been able to get the Bitcoin daemon to automatically restart. Rarely the daemon dies and it is important that it starts again without manual intervention. To get it to start automatically with Upstart I have followed the guide linked below. It starts with sudo start bitcoind as expected but the service does not restart if it fails.

Ubuntu Linux — How do I start bitcoind as a service to run automatically?

My conf file in /etc/init/ is as follows.

description "bitcoind"

start on filesystem
stop on runlevel [!2345]
oom score -500
expect fork
respawn
respawn limit 20 90 # 10 times in 60 seconds

script
user=bitcoinuser
home=/home/$user
cmd=/usr/bin/bitcoind
pidfile=$home/.bitcoin/bitcoind.pid
# Don't change anything below here unless you know what you're doing
[[ -e $pidfile &amp;&amp; ! -d "/proc/$(cat $pidfile)" ]] &amp;&amp; rm $pidfile
[[ -e $pidfile &amp;&amp; "$(cat /proc/$(cat $pidfile)/cmdline)" != $cmd* ]] &amp;&amp; rm $pidfile
exec start-stop-daemon --start -c $user --chdir $home --pidfile $pidfile --startas $cmd -b --nicelevel 15 -m
end script


If I run ps -aux | grep bitcoind to get the process ID and kill it the daemon does not restart as desired. I have followed the guide and cannot see what is wrong with the set up. As a side note sudo stop bitcoind does not actually stop it from running.

Any help on this would be appreciated.
I'm running a RaspberryPi Bitcoin node. Since I discovered that the node had sometimes crashed due to overload, I put an hourly starting command into crontab:

@hourly &lt;completePath&gt;/bitcoind -daemon -disablewallet


If bitcoind is already running, it fails to start due to not getting a lock on the data directory. Otherwise, the server will be restarted with at most one hour of downtime.

I'm sure there are more elegant solutions, but I didn't explore it much further as this worked for me.