fix redis persistence and #4449

This commit is contained in:
/rootzoll 2024-04-01 13:35:45 +02:00 committed by GitHub
parent 502782f5ed
commit 5022cfaf37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 12 deletions

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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