From 5022cfaf3782af0b49686f67448267b5effcf1c4 Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Mon, 1 Apr 2024 13:35:45 +0200 Subject: [PATCH] fix redis persistence and #4449 --- build_sdcard.sh | 1 + home.admin/_bootstrap.sh | 2 -- home.admin/_cache.sh | 12 ++++++------ home.admin/config.scripts/blitz.preparerelease.sh | 12 +++++++++--- home.admin/config.scripts/lnd.monitor.sh | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/build_sdcard.sh b/build_sdcard.sh index 5016305a2..9ce98c8f4 100644 --- a/build_sdcard.sh +++ b/build_sdcard.sh @@ -444,6 +444,7 @@ if [ "${baseimage}" = "raspios_arm64" ]; then fi echo "max_usb_current=1" | tee -a $configFile echo "dtparam=nvme" | tee -a $configFile + echo "dtparam=watchdog=off" | tee -a $configFile echo 'dtoverlay=pi3-disable-bt' | tee -a $configFile echo 'dtoverlay=disable-bt' | tee -a $configFile else diff --git a/home.admin/_bootstrap.sh b/home.admin/_bootstrap.sh index 544514d15..510db9ac4 100755 --- a/home.admin/_bootstrap.sh +++ b/home.admin/_bootstrap.sh @@ -450,8 +450,6 @@ fi # from actions above if [ "${systemInitReboot}" == "1" ]; then - echo "Stopping Redis server" >> $logFile - systemctl stop redis echo "Reboot" >> $logFile cp ${logFile} /home/admin/raspiblitz.systeminit.log /home/admin/_cache.sh set state "reboot" diff --git a/home.admin/_cache.sh b/home.admin/_cache.sh index 7547afe72..e6e8fa8ca 100755 --- a/home.admin/_cache.sh +++ b/home.admin/_cache.sh @@ -111,16 +111,16 @@ elif [ "$1" = "keyvalue" ] && [ "$2" = "on" ]; then sudo apt install -y redis-server # edit config: dont save to disk - sudo sed -i "/^save .*/d" /etc/redis/redis.conf - sudo sed -i 's/^stop-writes-on-bgsave-error yes/stop-writes-on-bgsave-error no/' /etc/redis/redis.conf + # echo "# edit config" + sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.backup + sudo sed -i "s/^# save \"\"/save \"\"/g" /etc/redis/redis.conf + sudo sed -i "s/^appendonly yes/appendonly no/g" /etc/redis/redis.conf + sudo sed -i "s/^stop-writes-on-bgsave-error yes/stop-writes-on-bgsave-error no/g" /etc/redis/redis.conf + echo "# restart and remove db dump file" # restart with new config if ! ischroot; then sudo systemctl restart redis-server; fi - - # clean old databases if exist sudo rm /var/lib/redis/dump.rdb 2>/dev/null - - # restart again this time there is no old data dump to load if ! ischroot; then sudo systemctl restart redis-server; fi # uninstall diff --git a/home.admin/config.scripts/blitz.preparerelease.sh b/home.admin/config.scripts/blitz.preparerelease.sh index afade33a8..caf4fd561 100755 --- a/home.admin/config.scripts/blitz.preparerelease.sh +++ b/home.admin/config.scripts/blitz.preparerelease.sh @@ -57,9 +57,15 @@ echo "OK" # make sure that every install runs API with own secret # https://github.com/raspiblitz/raspiblitz/issues/4469 echo -echo "disable redis for initial start ..." -sudo systemctl stop redis 2>/dev/null -sudo systemctl disable redis 2>/dev/null +# check if redis is enabled +REDIS_ENABLED=$(sudo systemctl is-enabled redis 2>/dev/null | grep -c enabled) +if [ ${REDIS_ENABLED} -gt 0 ]; then + echo "disable redis for initial start ..." + sudo systemctl stop redis 2>/dev/null + sudo systemctl disable redis 2>/dev/null +fi +echo "deleting redis data (if still there) ..." +sudo rm /var/lib/redis/dump.rdb 2>/dev/null echo "OK" echo diff --git a/home.admin/config.scripts/lnd.monitor.sh b/home.admin/config.scripts/lnd.monitor.sh index 76ba73c33..e08a58ff9 100755 --- a/home.admin/config.scripts/lnd.monitor.sh +++ b/home.admin/config.scripts/lnd.monitor.sh @@ -140,7 +140,7 @@ if [ "$2" = "info" ]; then # get data ln_getInfo=$($lndcli_alias getinfo 2>/dev/null) - if [ "${ln_getInfo}" == "" ]; then + if [ $? != 0 ] || [ "${ln_getInfo}" == "" ]; then echo "command='$lndcli_alias getinfo'" echo "error='no data'" exit 1