Page 1 of 1
Run a script on update ?
Posted: Thursday 21 July 2016 12:27
by bxlouis
Hi everybody,
I changed the "switch_icons.txt" file in pi/domoticz/www/ in order to get nice custom icons.
However, every time I update Domoticz, this file is reset and I have to manually copy/paste my custom "switch_icons.txt" file.
I would like to setup a script which detects when Domoticz is updated and copies the new file before reboot.
Is it possible ?
Can someone help me ?
Many thanks !
Re: Run a script on update ?
Posted: Friday 22 July 2016 20:38
by georgesattali
Hello,
maybe it would be simpler to make a new virtual device that runs this script when activated ?
you would have to activate it manually each time you update Dz, but as updating keeps scripts and devices, that would be not such a great pain.
So, ... not fully automatic, but easy and functionnal.
See you,
GD
Re: Run a script on update ?
Posted: Saturday 23 July 2016 0:28
by bxlouis
Hi georgesattali,
Thanks for your answer! Indeed, even if it's not fully automatic, it would be a good start!
Would you have any idea about such a script? I don't know much about those.
MP en français si c'est plus simple

Re: Run a script on update ?
Posted: Saturday 23 July 2016 7:16
by Egregius
Put your custom files in /home/pi/custom
then create a bash script /home/pi/afterupdate.sh
make sure it's executable with chmod +x afterupdate.sh
Code: Select all
#!/bin/bash
cp /home/pi/custom/switch_icons.txt /home/pi/domoticz/www/switch_icons.txt
Call the script as on action on your dummy device with script:///home/pi/afterupdate.sh
Re: Run a script on update ?
Posted: Monday 25 July 2016 9:33
by Egregius
You can even go further with a script like this. You gave me the idea to replace stuff in the webinterface automatically, thanks
I like to see the whole table in devices and so, so with this I disabled paging:
Code: Select all
#!/bin/bash
find /volume1/@appstore/domoticz/www/ -type f -name "*.js" -exec sudo sed -i 's/\"iDisplayLength\" : 25,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.html" -exec sudo sed -i 's/\"iDisplayLength\" : 25,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.js" -exec sudo sed -i 's/\"iDisplayLength\": 25,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.html" -exec sudo sed -i 's/\"iDisplayLength\": 25,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.js" -exec sudo sed -i 's/\"iDisplayLength\" : 10,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.html" -exec sudo sed -i 's/\"iDisplayLength\" : 10,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.js" -exec sudo sed -i 's/\"iDisplayLength\": 10,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.html" -exec sudo sed -i 's/\"iDisplayLength\": 10,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.js" -exec sudo sed -i 's/\"iDisplayLength\" : 100,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
find /volume1/@appstore/domoticz/www/ -type f -name "*.html" -exec sudo sed -i 's/\"iDisplayLength\" : 100,/\"iDisplayLength\" : -1,\"paging\": false,/g' {} +
This could be extended to other web interface related stuff.