Page 1 of 1

I can not unzip *.gz file

Posted: Thu Dec 17, 2015 1:14 pm
by rjobaan
I succeed in creating a backup file of the domoticz.db

Code: Select all

[## BACKUP DATABASE
BACKUPFILE="domoticz_$TIMESTAMP.db.gz" #

### Create backup and ZIP it
/usr/bin/curl -s http://$DOMO_IP:$DOMO_PORT/backupdatabase.php > /tmp/$BACKUPFILE
gzip -9 /tmp/$BACKUPFILE/code]

And I moved the backup to my HDD on other PI with SCP.
Now I want to unzip that file again with
[code]
tar -xvf domoticz_20151217095013.db.gz
But nothing happens
What am I doing wrong?
I also was wondering what is the difference between *.gz (this is used for backing up database) and *.tar.gz (this is used to backup the whole folder)
see https://www.domoticz.com/wiki/Daily_bac ... ternal_hdd

Re: I can not unzip *.gz file

Posted: Thu Dec 17, 2015 1:37 pm
by DougieLawson
To read a *.gz use, for example, zcat foo.gz | less
To unzip a *.gz use gunzip foo.gz and it will unzip to a file called foo.
To work with ANY tar file use tar xavf foo.tgz or tar xavf foo.tar.gz or tar xavf foo.tar it even works for tar files that are zipped with bzip2 tar xavf foo.tar.bz2. The magic is the "a" command which tells tar to examine the magic number of the file and automatically choose the right method to handle it.

Re: I can not unzip *.gz file

Posted: Thu Dec 17, 2015 7:24 pm
by rjobaan
Thanks gunzip en tar xavf worked for me!

I used tar -zcvf /tmp/$BACKUPFILEGZ /home/pi/domoticz/domoticz.db
and send this file to other pi with scp
and their I unzipped it to check it
So I opened the unzipped file and opened the file in SQL light but get the message
file is encrypted or not a database.....

how can that be?