Dashticz - Auto backup on Synology NAS

Dashticz, alternative dashboard based on HTML, CSS, jQuery

Moderators: leecollings, htilburgs, robgeerts

Post Reply
Ingmar
Posts: 51
Joined: Sunday 04 May 2014 1:34
Target OS: NAS (Synology & others)
Domoticz version:
Location: The Netherlands
Contact:

Dashticz - Auto backup on Synology NAS

Post by Ingmar »

First of all a big thanks to Rob for making Dashticz, it's amazing and it is exactly what I was missing with Domoticz. I vote it should be standard incorporated in Domoticz!

I'm running Domoticz on my Synology NAS and as Dashticz is not an official part of Domoticz, Dashticz gets lost after Domoticz updates including the customisations that were made. So I looked into automatically backing up the Dashticz data, turns out it is quite simple and does not really require complicated coding. I'm not an expert, but I'm posting this to share with others and to maybe we can jointly improve it.

Synology has a Task Scheduler incorporated in the control panel, this can be used to run custom script files (although that doesn't seem to work properly for me due to root permission issues). But it can also be used to directly execute a line of code without having a separate script file. See below how to make this happen for daily backing up the "custom" folder of Dashticz:
  • 1. Go to Control Panel > Task Scheduler and click on Create > Scheduled task > User-defined script.
  • 2. In the window that opens, give your task a name (on my system the user is default set on "root" and "enabled" is ticked). And then click on "Schedule".
    1.png
    1.png (6.37 KiB) Viewed 1661 times
  • 3. At the "Schedule" tab, choose the settings that you like. In the example below it backs up every day at 04:00. Then click on the "Task settings" tab.
    2.png
    2.png (13.91 KiB) Viewed 1661 times
  • 4. At the "Task settings" tab, paste the following code in the "user-defined script" box.
    3.png
    3.png (21.47 KiB) Viewed 1661 times

    Code: Select all

    sudo tar -cpzf /backup/destination/path/Dashticz_backup_`date +%Y-%m-%d`.tar.gz /source/path/domoticz/www/dashticz_v2/custom
    For example, in my case, I'm using:

    Code: Select all

    sudo tar -cpzf /volume1/Dropbox/AutoBackups/Dashticz/Dashticz_backup_`date +%Y-%m-%d`.tar.gz /usr/local/domoticz/www/dashticz_v2/custom
    This code creates a compressed file with filename "Dashticz_backup_2017-09-14.tar.gz" (date is automatically changed) with the contents of the "custom" folder of Dashticz, it then places it in my destination folder which in my case is a folder I sync with dropbox to have an offsite backup of the files, but you can place it in any folder really. Please note that the source path is not the same for everybody as Domoticz is installed in the folder of a user on your NAS, so check where Domoticz is installed on your NAS.
  • 5. Click "OK" to save your task.
  • 6. You can test your script in the Task Scheduler by right clicking on it and choose "run". It will ask for confirmation, click "yes".
    If the script doesn't work it is most likely because there is a mistake in the folder naming (mind the capitals) or the folder you want to place the backup in doesn't exist yet.

The questions i still have are;
  • Is there any other data that I would need to back-up? I can imagine the "img" folder for custom background images etc. Initially i backed up the whole Dashticz folder, but that quickly adds up in MBs if you daily back it up. Differential backups would be better in that case, but I don't know how to make that happen in a simple way. Plus what happens if the Dashticz folder is empty of non existent, will the backup just fail or will it replace the date with an empty folder?
  • It would be nice to have a similar setup for restoring the data (e.g. after a Domoticz update) because the Tasks on the Synology can be easily manually activated. Maybe this could be something like

    Code: Select all

    cp -a /backup/source/path/. /domoticz/www/

Gr. Ingmar
Synology NAS with stable release, AEON Z-wave, RFXCOM, Toon, Echo Dot, HAbridge, HarmonyHUB, Dashticz.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Dashticz - Auto backup on Synology NAS

Post by EdwinK »

I;'m running this outside the domoticz/www folder. I have webstation enabled and the script is placed inside the web folder. In this case, whenever Domoticz is updated, Dashticz still works.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Ingmar
Posts: 51
Joined: Sunday 04 May 2014 1:34
Target OS: NAS (Synology & others)
Domoticz version:
Location: The Netherlands
Contact:

Re: Dashticz - Auto backup on Synology NAS

Post by Ingmar »

Ahh, so you didn't install Dashticz in the domoticz folder, but in the Synology webstation folder, as if it is a website on it's own?! That is interesting. Is it a matter of moving the Dashticz folder to the "www" folder of the Synology webstation one? Or does it take a bit more than that?
Synology NAS with stable release, AEON Z-wave, RFXCOM, Toon, Echo Dot, HAbridge, HarmonyHUB, Dashticz.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: Dashticz - Auto backup on Synology NAS

Post by EdwinK »

Nope. Just installing it there and it worked right away. :)
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest