<p>How can I run bitcoind automatically five minutes after restart?</p>

<p>So far I have crontab set up to reboot my computer every morning at 4AM (it runs into issues when it stays on for more than a couple days). I also have tried to use crontab to restart bitcoind on @reboot, but haven't had any success with that. </p>

<p>I am currently using Ubuntu 18.10, and bitcoind v0.18.0.0. 
Here is my current crontab:</p>

<pre><code>0 4 * * * /sbin/shutdown -r +5
@reboot /usr/bin/bitcoind -daemon -conf=/home/&lt;username&gt;/.bitcoin/bitcoin.conf
</code></pre>

CC BY-SA 4.0
2019-11-03T14:07:34.493Z
Don't you mean `@reboot /path/to/bitcoind -daemon ...`?  You left out the command name.
Nate Eldredge
CC BY-SA 4.0
2019-11-03T14:10:41.900Z
If you want to wait five minutes, you can do `@reboot sleep 5m ; /path/to/bitcoind -daemon ...`
Nate Eldredge
CC BY-SA 4.0
2019-11-03T18:33:42.677Z
Fixed to reflect actual crontab. I think I've diagnosed the problem: looking at debug.log, bitcoind can't start an http server on reboot because when my computer shuts down, it doesn't kill the original bitcoind process. As a result, when I start up, bitcoind doesn't have access to port 8332. As a result, I added the following to the first crontab entry: `0 4 * * * bitcoin-cli stop; /sbin/shutdown -r +5`
I added the `sleep 5m`. Appears to do the job.
Marty
CC BY-SA 4.0
2019-11-03T22:22:51.383Z
If you just need it to shut down and start as your computer reboots, why not use the systemd service?
Raghav Sood
CC BY-SA 4.0
2019-11-04T02:30:59.377Z
@Marty When the computer shuts down the original bitcoind process does get killed. There's something else causing the issue. You may want to look at the `at` command and trigger it at startup. https://unix.stackexchange.com/questions/146615/run-at-command-in-two-minutes-time
Jose Fonseca
<bitcoin-core><bitcoind><ubuntu>
Automatically restarting bitcoind five minutes after reboot on ubuntu
Marty
# Automatically restarting bitcoind five minutes after reboot on ubuntu

(Asked by: username_0 on 2019-11-03)

How can I run bitcoind automatically five minutes after restart?
So far I have crontab set up to reboot my computer every morning at 4AM (it runs into issues when it stays on for more than a couple days). I also have tried to use crontab to restart bitcoind on @reboot, but haven't had any success with that. 
I am currently using Ubuntu 18.10, and bitcoind v0.18.0.0. 
Here is my current crontab:
0 4 * * * /sbin/shutdown -r +5
@reboot /usr/bin/bitcoind -daemon -conf=/home//.bitcoin/bitcoin.conf

**Tags:** bitcoin-core, bitcoind, ubuntu

> **Comments:**
> **username_1**: Don't you mean `@reboot /path/to/bitcoind -daemon ...`?  You left out the command name.  
> **username_1**: If you want to wait five minutes, you can do `@reboot sleep 5m ; /path/to/bitcoind -daemon ...`  
> **username_0**: Fixed to reflect actual crontab. I think I've diagnosed the problem: looking at debug.log, bitcoind can't start an http server on reboot because when my computer shuts down, it doesn't kill the original bitcoind process. As a result, when I start up, bitcoind doesn't have access to port 8332. As a result, I added the following to the first crontab entry: `0 4 * * * bitcoin-cli stop; /sbin/shutdown -r +5` I added the `sleep 5m`. Appears to do the job.  
> **username_2**: If you just need it to shut down and start as your computer reboots, why not use the systemd service?  
> **username_3**: @username_0 When the computer shuts down the original bitcoind process does get killed. There's something else causing the issue. You may want to look at the `at` command and trigger it at startup. https://unix.stackexchange.com/questions/146615/run-at-command-in-two-minutes-time  

---

## 0 answers

