Page 1 of 1

user specific database filename for export

Posted: Thursday 31 May 2018 11:21
by poudenes
hi All,

When i update to a later beta i always create a backup of the database. (I know it also backup automatic when you enable it) But want always the last recent information.

Maybe a idea to let users made a custom filename that will used when you backup a database for example:

database-versionnumber-date : database-v3.9462-31-05-2018.db

Create some pull down menu's where you have some pre configured options. and maybe 1 open field for user custom text

cheers,
Peter

Re: user specific database filename for export

Posted: Thursday 31 May 2018 12:14
by Egregius
Is it that hard to rename the file that is downloaded during the backup?
Besides that, I never had a database issue with updates. I just rely on my daily backup for wurst case scenario's.

Re: user specific database filename for export

Posted: Thursday 31 May 2018 17:45
by poudenes
its just a suggestion... :mrgreen:
And domoticz is automation so why we don't automate this... haha

Re: user specific database filename for export

Posted: Thursday 31 May 2018 21:36
by niki_lauda
poudenes wrote: Thursday 31 May 2018 11:21 hi All,

When i update to a later beta i always create a backup of the database. (I know it also backup automatic when you enable it) But want always the last recent information.

Maybe a idea to let users made a custom filename that will used when you backup a database for example:

database-versionnumber-date : database-v3.9462-31-05-2018.db

Create some pull down menu's where you have some pre configured options. and maybe 1 open field for user custom text

cheers,
Peter
There is a script that does the job. I made a dummy button that kicks off a script that saves the database on en different location. You can FTP it, I just store it on a shared disk. It runs at 03:00 and at 14:00 hour.
Here was an other post http://www.domoticz.com/forum/viewtopic ... RS#p111150

Code: Select all

#!/bin/bash
    # LOCAL/FTP/SCP/MAIL PARAMETERS
    SERVER="10.0.X.X"   # IP of Network disk, used for ftp
    USERNAME="XX"         # FTP username of Network disk used for ftp
    PASSWORD="XXXXXXXXX"         # FTP password of Network disk used for ftp
    DESTDIR="/opt/backup"   # used for temorarily storage
    DOMO_IP="10.0.X.X"  # Domoticz IP 
    DOMO_PORT="8080"        # Domoticz port 
    ### END OF USER CONFIGURABLE PARAMETERS
    TIMESTAMP=`/bin/date +%Y%m%d%H%M%S`
    BACKUPFILE="domoticz_$TIMESTAMP.db" # backups will be named "domoticz_YYYYMMDDHHMMSS.db.gz"
    BACKUPFILEGZ="$BACKUPFILE".gz
    ### Create backup and ZIP it
    /usr/bin/curl -s http://127.0.0.1:8080/backupdatabase.php > /mnt/nas20/$BACKUPFILE
    gzip -9 /mnt/nas20/$BACKUPFILE
    ### Send to Network disk through FTP
    ### curl -s --disable-epsv -v -T"/tmp/$BACKUPFILEGZ" -u"$USERNAME:$PASSWORD" "ftp://$SERVER"
    ### Remove temp backup file
    ###/bin/rm /tmp/$BACKUPFILEGZ
    ### Done!