2021-04-07 23:24:55 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# get raspiblitz config
|
|
|
|
echo "get raspiblitz config"
|
|
|
|
source /home/admin/raspiblitz.info
|
|
|
|
source /mnt/hdd/raspiblitz.conf
|
|
|
|
|
2021-06-28 11:48:36 +01:00
|
|
|
# source <(/home/admin/config.scripts/network.aliases.sh getvars <lnd|cln> <mainnet|testnet|signet>)
|
2021-07-18 16:37:40 +01:00
|
|
|
source <(/home/admin/config.scripts/network.aliases.sh getvars cln $1)
|
2021-06-28 11:48:36 +01:00
|
|
|
|
2021-04-07 23:24:55 +01:00
|
|
|
# BASIC MENU INFO
|
|
|
|
WIDTH=64
|
|
|
|
BACKTITLE="RaspiBlitz"
|
2021-08-30 21:36:06 +02:00
|
|
|
TITLE=" ${CHAIN} System Options "
|
2021-04-07 23:24:55 +01:00
|
|
|
MENU="" # adds lines to HEIGHT
|
|
|
|
OPTIONS=() # adds lines to HEIGHt + CHOICE_HEIGHT
|
|
|
|
|
2021-08-30 21:36:06 +02:00
|
|
|
if [ "${lightning}" == "lnd" ] || [ "${lnd}" == "on" ]; then
|
|
|
|
OPTIONS+=(${network}LOG "Monitor the debug.log for ${CHAIN}")
|
|
|
|
OPTIONS+=(${network}CONF "Edit the bitcoin.conf")
|
|
|
|
fi
|
|
|
|
|
2021-08-31 13:43:28 +02:00
|
|
|
if grep "^${netprefix}lnd=on" /mnt/hdd/raspiblitz.conf;then
|
|
|
|
OPTIONS+=(LNDLOG "Monitor the lnd.log for ${CHAIN}")
|
|
|
|
OPTIONS+=(LNDCONF "Edit the lnd.conf for ${CHAIN}")
|
|
|
|
fi
|
2021-04-07 23:24:55 +01:00
|
|
|
|
2021-07-18 20:07:07 +01:00
|
|
|
if grep "^${netprefix}cln=on" /mnt/hdd/raspiblitz.conf;then
|
2021-07-18 16:37:40 +01:00
|
|
|
OPTIONS+=(CLNLOG "Monitor the CLN log for ${CHAIN}")
|
|
|
|
OPTIONS+=(CLNCONF "Edit the CLN config for ${CHAIN}")
|
|
|
|
fi
|
|
|
|
|
2021-08-31 13:43:28 +02:00
|
|
|
if [ "${runBehindTor}" == "on" ] && [ "${netprefix}" == "" ]; then
|
2021-04-07 23:24:55 +01:00
|
|
|
OPTIONS+=(TORLOG "Monitor the Tor Service with Nyx")
|
|
|
|
OPTIONS+=(TORRC "Edit the Tor Configuration")
|
|
|
|
fi
|
2021-08-16 16:41:23 +02:00
|
|
|
|
2021-04-07 23:24:55 +01:00
|
|
|
OPTIONS+=(CUSTOMLOG "Monitor a custom service")
|
|
|
|
OPTIONS+=(CUSTOMRESTART "Restart a custom service")
|
2021-08-16 16:41:23 +02:00
|
|
|
|
|
|
|
CHOICE_HEIGHT=$(("${#OPTIONS[@]}/2+1"))
|
|
|
|
HEIGHT=$((CHOICE_HEIGHT+6))
|
2021-04-07 23:24:55 +01:00
|
|
|
CHOICE=$(dialog --clear \
|
|
|
|
--backtitle "$BACKTITLE" \
|
|
|
|
--title "$TITLE" \
|
|
|
|
--ok-label "Select" \
|
|
|
|
--cancel-label "Main menu" \
|
|
|
|
--menu "$MENU" \
|
|
|
|
$HEIGHT $WIDTH $CHOICE_HEIGHT \
|
|
|
|
"${OPTIONS[@]}" \
|
|
|
|
2>&1 >/dev/tty)
|
|
|
|
|
|
|
|
case $CHOICE in
|
|
|
|
${network}LOG)
|
2021-06-28 11:48:36 +01:00
|
|
|
if [ ${CHAIN} = signet ]; then
|
2021-07-18 16:37:40 +01:00
|
|
|
bitcoinlogpath="/mnt/hdd/bitcoin/signet/debug.log"
|
2021-06-28 11:48:36 +01:00
|
|
|
elif [ ${CHAIN} = testnet ]; then
|
2021-07-18 16:37:40 +01:00
|
|
|
bitcoinlogpath="/mnt/hdd/bitcoin/testnet3/debug.log"
|
2021-06-28 11:48:36 +01:00
|
|
|
elif [ ${CHAIN} = mainnet ]; then
|
2021-07-18 16:37:40 +01:00
|
|
|
bitcoinlogpath="/mnt/hdd/bitcoin/debug.log"
|
2021-06-28 11:48:36 +01:00
|
|
|
fi
|
2021-04-07 23:24:55 +01:00
|
|
|
clear
|
|
|
|
echo
|
2021-06-28 11:48:36 +01:00
|
|
|
echo "Will follow the ${bitcoinlogpath}"
|
|
|
|
echo "running: 'sudo tail -n 30 -f ${bitcoinlogpath}'"
|
2021-04-07 23:24:55 +01:00
|
|
|
echo
|
|
|
|
echo "Press ENTER to continue"
|
2021-04-18 22:58:48 +02:00
|
|
|
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
|
|
|
echo "###############################################################################"
|
2021-04-07 23:24:55 +01:00
|
|
|
read key
|
2021-06-28 11:48:36 +01:00
|
|
|
sudo tail -n 30 -f ${bitcoinlogpath};;
|
2021-04-07 23:24:55 +01:00
|
|
|
${network}CONF)
|
|
|
|
if /home/admin/config.scripts/blitz.setconf.sh "/mnt/hdd/${network}/${network}.conf" "root"
|
|
|
|
then
|
|
|
|
whiptail \
|
|
|
|
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
2021-06-28 11:48:36 +01:00
|
|
|
--yesno "To apply the new settings ${netprefix}${network}d needs to restart.
|
|
|
|
Do you want to restart ${netprefix}${network}d now?" 10 55
|
2021-04-07 23:24:55 +01:00
|
|
|
if [ $? -eq 0 ]; then
|
2021-06-28 11:48:36 +01:00
|
|
|
echo "# Restarting ${netprefix}${network}d"
|
|
|
|
sudo systemctl restart ${netprefix}${network}d
|
2021-04-07 23:24:55 +01:00
|
|
|
else
|
|
|
|
echo "# Continue without restarting."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "# No change made"
|
|
|
|
fi;;
|
|
|
|
LNDLOG)
|
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo "Will follow the /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log"
|
|
|
|
echo "running 'sudo tail -n 30 -f /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log'"
|
|
|
|
echo
|
|
|
|
echo "Press ENTER to continue"
|
2021-04-18 22:58:48 +02:00
|
|
|
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
|
|
|
echo "###############################################################################"
|
2021-04-07 23:24:55 +01:00
|
|
|
read key
|
|
|
|
sudo tail -n 30 -f /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log;;
|
|
|
|
LNDCONF)
|
2021-06-28 11:48:36 +01:00
|
|
|
if /home/admin/config.scripts/blitz.setconf.sh "/mnt/hdd/lnd/${netprefix}lnd.conf" "root"
|
2021-04-07 23:24:55 +01:00
|
|
|
then
|
|
|
|
whiptail \
|
|
|
|
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
|
|
|
--yesno "To apply the new settings LND needs to restart.
|
|
|
|
Do you want to restart LND now?" 10 55
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "# Restarting LND"
|
2021-07-18 16:37:40 +01:00
|
|
|
sudo systemctl restart ${netprefix}lnd
|
|
|
|
else
|
|
|
|
echo "# Continue without restarting."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "# No change made"
|
|
|
|
fi;;
|
|
|
|
CLNLOG)
|
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo "Will follow the /home/bitcoin/.lightning/${CLNETWORK}/cl.log"
|
|
|
|
echo "running 'sudo tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log'"
|
|
|
|
echo
|
|
|
|
echo "Press ENTER to continue"
|
|
|
|
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
|
|
|
echo "###############################################################################"
|
|
|
|
read key
|
|
|
|
sudo tail -n 30 -f /home/bitcoin/.lightning/${CLNETWORK}/cl.log;;
|
|
|
|
CLNCONF)
|
2021-08-31 20:31:48 +01:00
|
|
|
if /home/admin/config.scripts/blitz.setconf.sh "${CLNCONF}" "root"
|
2021-07-18 16:37:40 +01:00
|
|
|
then
|
|
|
|
whiptail \
|
|
|
|
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
|
|
|
--yesno "To apply the new settings C-lightning needs to restart.
|
|
|
|
Do you want to restart C-lightning now?" 0 0
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "# Restarting C-lightning"
|
|
|
|
sudo systemctl restart ${netprefix}lightningd
|
2021-04-07 23:24:55 +01:00
|
|
|
else
|
|
|
|
echo "# Continue without restarting."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "# No change made"
|
2021-07-18 16:37:40 +01:00
|
|
|
fi;;
|
2021-04-07 23:24:55 +01:00
|
|
|
TORLOG)
|
|
|
|
sudo -u debian-tor nyx;;
|
|
|
|
TORRC)
|
|
|
|
if /home/admin/config.scripts/blitz.setconf.sh "/etc/tor/torrc" "debian-tor"
|
|
|
|
then
|
|
|
|
whiptail \
|
|
|
|
--title "Restart" --yes-button "Restart" --no-button "Not now" \
|
|
|
|
--yesno "To apply the new settings Tor needs to restart.
|
|
|
|
Do you want to restart Tor now?" 10 55
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "# Restarting tor"
|
|
|
|
sudo systemctl restart tor@default
|
|
|
|
else
|
|
|
|
echo "# Continue without restarting."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "# No change made"
|
|
|
|
fi;;
|
|
|
|
CUSTOMLOG)
|
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo "Example list:
|
|
|
|
btc-rpc-explorer, btcpayserver, circuitbreaker,
|
2021-08-23 17:23:01 +01:00
|
|
|
specter, getty@tty1, electrs, litd,
|
2021-04-07 23:24:55 +01:00
|
|
|
lnbits, mempool, nbxlorer, nginx, RTL, telegraf,
|
|
|
|
thunderhub, tor@default, tor@lnd, tor
|
|
|
|
"
|
|
|
|
echo "Type the name of the service you would like to monitor:"
|
|
|
|
read SERVICE
|
|
|
|
echo
|
2021-04-17 21:30:10 +01:00
|
|
|
echo "Will show the logs with:"
|
2021-04-18 22:58:48 +02:00
|
|
|
echo "'sudo journalctl -n 10 -fu $SERVICE'"
|
2021-04-07 23:24:55 +01:00
|
|
|
echo
|
2021-04-18 22:58:48 +02:00
|
|
|
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
|
|
|
echo "###############################################################################"
|
|
|
|
sudo journalctl -n 10 -fu $SERVICE;;
|
2021-04-07 23:24:55 +01:00
|
|
|
CUSTOMRESTART)
|
|
|
|
clear
|
|
|
|
echo
|
|
|
|
echo "Example list:
|
|
|
|
btc-rpc-explorer, btcpayserver, circuitbreaker,
|
2021-08-23 17:23:01 +01:00
|
|
|
specter, getty@tty1, electrs, litd,
|
2021-04-07 23:24:55 +01:00
|
|
|
lnbits, mempool, nbxlorer, nginx, RTL, telegraf,
|
|
|
|
thunderhub, tor@default, tor@lnd, tor
|
|
|
|
"
|
|
|
|
echo "Type the name of the service you would like to restart:"
|
|
|
|
read SERVICE
|
|
|
|
echo
|
2021-04-17 21:30:10 +01:00
|
|
|
echo "Will use the command:"
|
|
|
|
echo "'sudo systemctl restart $SERVICE'"
|
2021-04-07 23:24:55 +01:00
|
|
|
echo
|
|
|
|
echo "Press ENTER to restart $SERVICE or use CTRL+C to abort"
|
|
|
|
read key
|
|
|
|
sudo systemctl restart $SERVICE
|
|
|
|
echo
|
2021-04-17 21:30:10 +01:00
|
|
|
echo "Will show the logs with:"
|
2021-04-18 22:58:48 +02:00
|
|
|
echo "'sudo journalctl -n 10 -fu $SERVICE'"
|
2021-04-07 23:24:55 +01:00
|
|
|
echo
|
2021-04-18 22:58:48 +02:00
|
|
|
echo "use CTRL+C any time to abort .. then use command 'raspiblitz' to return to menu"
|
|
|
|
echo "###############################################################################"
|
|
|
|
sudo journalctl -n 10 -fu $SERVICE;;
|
2021-04-07 23:24:55 +01:00
|
|
|
esac
|