hi, i find this error early today morning:
Code: Select all
2020-07-19 04:01:02.287 Error: SQL Query("VACUUM") : database disk image is malformed
at 04:01 i have cron that eecute a backup.sh script that perform a backup of my system:
01 04 * * * root /var/www/MyScripts/ftpbackup.sh
here the script:
Code: Select all
#!/bin/bash
# Simple backup script, edit your crontab and add the line
# 0 2 * * * /home/ftpbackup.sh o sistemd # every day at 02:00
# 08/01/2020 aggiunto controllo domoticz per verificare la riuscita del backup e mandare un avviso
HOST="XXXXXXXXXXXX.XXXXXXXXXXX.XX" # web server remoto ftp
USER="XXXXXXXXXX" # nominativo accesso
FTPPASS="XXXXXXXXX" # passwd
LCD="/var/www/" # percorso server locale dei files da salvare, sostituire il percorso se il server è /var/www/
RCD="/mirror/backup/" # creare una cartella da utilizzare su server remoto in questo caso "plugbox"
DOMOTIC_BK="/var/www/domoticz_backup" #cartella per domoticz backup
domoticzIP=192.168.0.105
domoticzPORT=8085
curl=$(which curl)
domoticzAlertIDX=156 ## define in domoticz as virtual Sensor type alert and enter idx here
green=1
yellow=2
orange=3
red=4
# Let domoticz and you know
signal()
{
echo $alertMessage
alertMessage=$(date "+%A%_d %B %Y - %H:%M : ")"%0ADB backup $alertMessage on $HOSTNAME"
alertMessage="${alertMessage// /+}"
domoticzURL="http://$domoticzIP:$domoticzPORT/json.htm?type=command¶m=udevice&idx=$domoticzAlertIDX&nvalue=$alertColor&svalue=$alertMessage"
$curl -sS $domoticzURL >/dev/null
}
LOCKFILE=/var/run/ftpbackup.pid
if [ -f $LOCKFILE ]; then
CPID="`cat $LOCKFILE`" # get Process number into variable CPID
fi
if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then # if Lockfile exists then kill process
alertMessage="already running as PID:$CPID"
alertColor=$red
signal
exit
else
alertColor=$yellow
alertMessage="Starting .. "
signal
fi
$curl -sS "http://$domoticzIP:$domoticzPORT/backupdatabase.php" > $DOMOTIC_BK/domoticz.db # copio database DOMOTICZ in /var/www/domoticz_backup"
#
#Check result
#
if test $? -ne 0 ; then
alertMessage="backupdatabase.php failed"
alertColor=$red
signal
exit 1
fi
# make sure the lockfile is removed when we exit and then claim it
trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
echo $$ > ${LOCKFILE}
# upload files
lftp -e "set ftp:list-options -a;
open ftp://$USER:$FTPPASS@$HOST;
lcd $LCD;
cd $RCD;
mirror -n --only-newer -Re --use-cache;
quit"
#
#Check result
#
if test $? -ne 0 ; then
alertMessage="lftp failed"
alertColor=$red
signal
rm -f ${LOCKFILE}
exit 1
fi
#
# All OK
#
alertColor=$green
alertMessage="finished succesfully"
signal
rm -f ${LOCKFILE}
#eoj
could be that the reason?
i try to start manually from shell the script:
Code: Select all
pi@raspberrypi:/var/www/MyScripts $ ./ftpbackup.sh
Starting ..
./ftpbackup.sh: line 64: /var/run/ftpbackup.pid: Permission denied
/var/log/lftp/transfer_log: Permission denied.
lcd ok, local cwd=/var/www
cd ok, cwd=/mirror/backup
Total: 91 directories, 3117 files, 0 symlinks
New: 1 file, 0 symlinks
Modified: 5 files, 0 symlinks
6407895 bytes transferred in 1461 seconds (4.3 KiB/s)
finished succesfully
and inside domoticz log i now see:
Code: Select all
2020-07-19 04:01:02.287 Error: SQL Query("VACUUM") : database disk image is malformed
2020-07-19 09:45:53.296 Error: SQL Query("VACUUM") : database disk image is malformed
so i bet that this could be the reason....
this script for backup is used and unchenged since many months....the difference could be the upgarding of domoticz from beta version 12073 to actual one 12227 ?
thanks