Directory with persistent data cleanup?  [Solved]

Easy to use, 100% Lua-based event scripting framework.
Post Reply
cincuranet
Posts: 28
Joined: Sunday 01 October 2017 17:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Directory with persistent data cleanup?

Post by cincuranet » Thursday 28 June 2018 16:06

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)?

User avatar
waaren
Posts: 1057
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Directory with persistent data cleanup?  [Solved]

Post by waaren » Thursday 28 June 2018 20:02

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
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

cincuranet
Posts: 28
Joined: Sunday 01 October 2017 17:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Directory with persistent data cleanup?

Post by cincuranet » Thursday 28 June 2018 21:28

Yes, that's basically what I do. Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests