Author

Topic: Bitcoind server wrapper (Read 966 times)

full member
Activity: 220
Merit: 100
February 27, 2013, 11:26:18 PM
#7
Actually, I figured it out. Did some digging around and finally figured out how to write bash scripts. The script I made is posted below, il update the OP with it as well

Code:
#!/bin/bash

function checkServer {
local CHECK=$(pgrep bitcoind)

if [[ -z "$CHECK" ]]
then
echo 0
else
echo 1
fi
}

while sleep 600; do

if [ `checkServer` == 0 ]
then
echo Restarting Server
bitcoind -daemon
else
echo All is well
fi

done

hero member
Activity: 812
Merit: 1000
February 27, 2013, 10:21:44 PM
#6
perhaps instead of persisting with bitcoind, you could consider this option:

cURL
+
http://blockchain.info/api/blockchain_wallet_api
hero member
Activity: 826
Merit: 500
February 27, 2013, 10:11:10 PM
#5
you could run a command that ask the server for the balance, if it takes too long, kill the server and restart.
full member
Activity: 220
Merit: 100
February 27, 2013, 09:57:14 PM
#4
Sorry I forgot to mention, yes in linux. Would there be a way to say, run the script, which starts the server, and then checks to see if the server is still running say every 10 minutes, if not restart server?
hero member
Activity: 826
Merit: 500
February 25, 2013, 09:38:16 PM
#3

#!/bin/bash
while true
do
sleep 600
killall -9 bitcoind
sleep 5
/etc/init.d/bitcoind start
done






this would kill the bitcoind every 10 minutes and restart it.
hero member
Activity: 826
Merit: 500
February 25, 2013, 09:34:37 PM
#2
linux or windows?
full member
Activity: 220
Merit: 100
February 25, 2013, 03:12:41 PM
#1
Hey all, iv been having some issues with my Bitcoind server crashing due to running out of RAM. Obvious solution would be to just get more RAM, but currently cant afford that for at least a few weeks. Does anyone know of a wrapper that would automatically restart bitcoind once it detects a crash? Or maybe a tutorial/resource that would show me how to write up a quick script that would accomplish this? Major PITA to manually restart it each time.

also this is in linux.

*edit* Heres the solution I came up with. Fairly simple bash script that checks the server every 10 minutes.

Code:
#!/bin/bash

function checkServer {
local CHECK=$(pgrep bitcoind)

if [[ -z "$CHECK" ]]
then
echo 0
else
echo 1
fi
}

while sleep 600; do

if [ `checkServer` == 0 ]
then
echo Restarting Server
bitcoind -daemon
else
echo All is well
fi

done

Jump to: