Author

Topic: [Possible?] Auto shutdown the node before the laptop goes to sleep? (see inside) (Read 647 times)

copper member
Activity: 2856
Merit: 3071
https://bit.ly/387FXHi lightning theory
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.
s2
full member
Activity: 198
Merit: 123
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
legendary
Activity: 3276
Merit: 2442
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.
full member
Activity: 182
Merit: 100
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
legendary
Activity: 3276
Merit: 2442
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?
Jump to: