Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: mindrust on July 18, 2017, 09:29:36 PM



Title: [Possible?] Auto shutdown the node before the laptop goes to sleep? (see inside)
Post by: mindrust on July 18, 2017, 09:29:36 PM
I recently started to run a bitcoin node on my old netbook with Linux Mint 18 OS loaded. I was running a raspberry pi3 node but I sometimes get power cuts in my area and my database gets corrupted because my little pi don't have any batteries attached on it to protect itself. (nor does the USB hub which is connected to my HDD)

On the other hand my old netbook has a battery...

Is it possible to trigger
Code:
bitcoin-cli stop
command automatically before my netbook goes into sleep mode when its battery runs low?

For example; My netbook goes into sleep mode when there is %10 of the battery juice left but I want bitcoind to shut itself down when there is %15 left so it will be a super safe shut down. No fuck ups, no conflicts...

Or, Is it necessary at all?


Title: Re: [Possible?] Auto shutdown the node before the laptop goes to sleep? (see inside)
Post by: TheReamer on July 18, 2017, 09:38:57 PM
Most operating systems have features to modify actions on power low, which are you using?

For example, for w7: https://superuser.com/questions/283434/make-computer-shutdown-if-battery-50


Title: Re: [Possible?] Auto shutdown the node before the laptop goes to sleep? (see inside)
Post by: mindrust on July 18, 2017, 09:41:02 PM
Most operating systems have features to modify actions on power low, which are you using?

For example, for w7: https://superuser.com/questions/283434/make-computer-shutdown-if-battery-50

It is already  stated in the OP.

netbook with Linux Mint 18 OS loaded.


Title: Re: [Possible?] Auto shutdown the node before the laptop goes to sleep? (see inside)
Post by: s2 on August 07, 2017, 07:11:51 PM
Could you do something like this?

Code:
battery_level=`acpi -b | grep -P -o '[0-9]+(?=%)'`
if [ $battery_level -le 10 ]
then
    bitcoind stop
fi


Title: Re: [Possible?] Auto shutdown the node before the laptop goes to sleep? (see inside)
Post by: jackg on August 07, 2017, 07:44:17 PM
I recently started to run a bitcoin node on my old netbook with Linux Mint 18 OS loaded. I was running a raspberry pi3 node but I sometimes get power cuts in my area and my database gets corrupted because my little pi don't have any batteries attached on it to protect itself. (nor does the USB hub which is connected to my HDD)

On the other hand my old netbook has a battery...

Is it possible to trigger
Code:
bitcoin-cli stop
command automatically before my netbook goes into sleep mode when its battery runs low?

For example; My netbook goes into sleep mode when there is %10 of the battery juice left but I want bitcoind to shut itself down when there is %15 left so it will be a super safe shut down. No fuck ups, no conflicts...

Or, Is it necessary at all?

You could always use a command that checks if the netbook is charging, once the charger is removed, the node shuts down. Depending on how old it is, it might take mre than ~8% ttery to shutdown on (assuming it'll shutdown after 7% is left).

Else, use 25-30% just to make it safer for the node (if it's always plugged in, then you can expect the battery to start to drain as well powerwise after a few weeks/months depending on its reliability.