Page 1 of 1
Directory with persistent data cleanup?
Posted: Thursday 28 June 2018 16:06
by cincuranet
Hi, I noticed that the data directory, where the persistent data is stored, is not cleaned up when I delete the script. Is this expected? And is there a better solution to clean this up except "manually" matching script names and "data" names (I don't want to delete data files for scripts in use, to not loose data)?
Re: Directory with persistent data cleanup? [Solved]
Posted: Thursday 28 June 2018 20:02
by waaren
There is no mechanism in domoticz or dzVents to do this automatically but if you want do it programmatic you could use this small bash script
Code: Select all
#
# bash script to remove dzVents datafiles orphans
#
domoticzdir="/opt/domoticz" # Change to reflect your domoticz base directory
cd $domoticzdir/scripts/dzVents/data
for filename in *.lua; do
scriptfile=$(echo "../scripts/"$filename | sed -e 's/__data_//g')
if [ ! -f "$scriptfile" ] ;then
echo "$scriptfile not found!"
ls -l $filename # should not show a recent date
echo sudo rm -f $filename # remove the echo once convinced it will do the job expected
fi
done
Re: Directory with persistent data cleanup?
Posted: Thursday 28 June 2018 21:28
by cincuranet
Yes, that's basically what I do. Thanks.