User Tools

Site Tools


Backing up your data

Though you might use industrial storage solutions for the WebHMI, still there is always a risk of loosing your data in some cases:

  • Just forget to make a copy of the project - this is most common case. Backup files are created on local WebHMI storage for your convinience, but it's up to you to save the latest valuable changes on your PC or other storage.
  • Occasionnally clear all collected data, e.g. when restoring your backup with unchecked “keep data” option
  • Flash drive wearing out
  • Abrupt power off during critical file operation (which you can not control) - on virtual machine or WebHMI with failed backup battery
  • Filesystem/DB operations failure, which still have a minor chances to happen. That's why RAID technologies exist.

There is only one example how to avoid the consequences of data loss.

Crontab on Linux

Here is an example of how to setup your Linux machine to automatically save files from the /log folder on the WebHMI's storage:
# Create a folder ~/WEBHMI/log_backup, with the /tmp sub-folder.
# download the yesterday's log file to backup storage
yesterday=$(date +"%Y-%m-%d" -d yesterday)
# because login and pass for the ftp connection are unencrypted you can 
# restrict read/write access mode to the file with chmod command)
wget --user=admin --password='webhmi'$yesterday.sqlite3
#archive to save storage space
gzip -v log-$yesterday.sqlite3

Do not forget grant additional run permissions

chmod u+x /path_to_run/

Add the script to the crontab with the parameters:

10 0 * * * /path_to_run/

to run it every day at 00:10

New files will only be added to ~/WEBHMI/log_backup, nothing will be deleted from this folder.