printf "$%.2f\n" "$(echo "scale=10; $price * $1"| bc -l)"
fi
}
+
+# Bitcoin holds open the wallet file. this causes problems for a
+# secondary computer running bitcoin and receiving a backup. So, as a
+# workaround, I intend to manually enable the wallet when I want to use
+# it and leave it disabled otherwise.
+walleton() {
+ local active
+ active=false
+ no_on=true
+ if [[ ! $(readlink -f /var/lib/bitcoind/wallets) == /q/wallets ]]; then
+ if systemctl --quiet is-active bitcoind; then
+ if [[ -e /tmp/no-bitcoinon ]]; then
+ no_on=true
+ else
+ if [[ $EUID == 0 ]]; then
+ m install -T -o iank -g iank /dev/null /tmp/no-bitcoinon
+ else
+ m touch /tmp/no-bitcoinon
+ fi
+ fi
+ active=true
+ m ser stop bitcoind
+ fi
+ m s ln -s /q/wallets /var/lib/bitcoind
+ sudo chown -h bitcoin:bitcoin /var/lib/bitcoind/wallets
+ if $active; then
+ m ser start bitcoind
+ if ! $no_on; then
+ m rm /tmp/no-bitcoinon
+ fi
+ fi
+ fi
+}
+walletoff() {
+ local active
+ active=false
+ no_on=true
+ if [[ $(readlink -f /var/lib/bitcoind/wallets) == /q/wallets ]]; then
+ if systemctl --quiet is-active bitcoind; then
+ if [[ -e /tmp/no-bitcoinon ]]; then
+ no_on=true
+ else
+ if [[ $EUID == 0 ]]; then
+ m install -T -o iank -g iank /dev/null /tmp/no-bitcoinon
+ else
+ m touch /tmp/no-bitcoinon
+ fi
+ fi
+ active=true
+ m ser stop bitcoind
+ fi
+ m rm /var/lib/bitcoind/wallets
+ if $active; then
+ m ser start bitcoind
+ if ! $no_on; then
+ m rm /tmp/no-bitcoinon
+ fi
+ fi
+ fi
+}
#### end bitcoin related things
dnsb8
fi
- s /c/roles/prom_export/files/simple/usr/local/bin/fsf-install-node-exporter -l 127.0.0.1
+ sudo /c/roles/prom_export/files/simple/usr/local/bin/fsf-install-node-exporter -l 127.0.0.1
# ex for exporter
web-conf -p 9101 -f 9100 - apache2 ${HOSTNAME}ex.b8.nz <<'EOF'
case $HOSTNAME in
sy|kd)
sudo install -m 0755 -o root -g root -t /usr/bin /a/opt/bitcoin-26.0/bin/*
- sgo bitcoind
+ # Note: i leave it to system-status to start and stop bitcoin.
# note: the bitcoin user & group are setup in fai
sudo usermod -a -G bitcoin iank
# todo: make bitcoin have a stable uid/gid
- if [[ ! $(readlink -f /var/lib/bitcoind/wallets) == /q/wallets ]]; then
- mkdir -p /var/lib/bitcoind
- chown bitcoin:bitcoin /var/lib/bitcoind
- # 710 comes from the upstream bitcoin unit file
- chmod 710 /var/lib/bitcoind
- s lnf /q/wallets /var/lib/bitcoind
- sudo chown -h bitcoin:bitcoin /var/lib/bitcoind/wallets
- fi
+ sudo mkdir -p /var/lib/bitcoind
+ sudo chown bitcoin:bitcoin /var/lib/bitcoind
+ # 710 comes from the upstream bitcoin unit file
+ sudo chmod 710 /var/lib/bitcoind
# note, there exists
# /a/bin/ds/disabled/bitcoin
;;
#!/bin/bash
[[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE[0]}"
+if [[ -e /tmp/no-bitcoinoff ]]; then
+ exit 0
+fi
systemctl stop bitcoind
#!/bin/bash
[[ $EUID == 0 ]] || exec sudo "${BASH_SOURCE[0]}"
+if [[ -e /tmp/no-bitcoinon ]]; then
+ exit 0
+fi
systemctl start bitcoind
fi
}
myreboot() {
+ if [[ -e /tmp/myupgrade-noreboot ]]; then
+ e "would rebooted but /tmp/myupgrade-noreboot exists"
+ return
+ fi
+
for x in {30..1}; do
echo "pid $$. unattended upgrade, rebooting in $((x*10)) seconds" | wall -n 2>/dev/null
sleep 10
#!/bin/bash
set -e; . /usr/local/lib/bash-bear; set +e
+# kill 0 doesn't seem to be documented in man bash, but it kills the
+# background processes.
+# https://unix.stackexchange.com/questions/67532/what-does-kill-0-do-actually/67552
+trap "kill 0" EXIT
xmpp_users=(
anoukr
$logdir/rooms/*/$log_today 2>/dev/null \
| awk '$3 != "iank:"' | grep -i '\biank\b' | awk '{print $3; fflush()}' | sed 's/^/room /;s/@.*//' ||:
+ kill %
sleep 1
-
done
case $bat in
100|9?)
:
- #bitcoinon &
+ bitcoinon &
;;
esac
fi