Directory with persistent data cleanup? [Solved]
Moderator: leecollings
-
- Posts: 24
- Joined: Sunday 01 October 2017 17:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Directory with persistent data cleanup?
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)?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Directory with persistent data cleanup? [Solved]
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
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 24
- Joined: Sunday 01 October 2017 17:42
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Directory with persistent data cleanup?
Yes, that's basically what I do. Thanks.
Who is online
Users browsing this forum: No registered users and 1 guest