rjobaan
Posts: 53
Joined: Sun Aug 18, 2013 1:07 pm

I can not unzip *.gz file

Thu Dec 17, 2015 1:14 pm

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

User avatar
DougieLawson
Posts: 39565
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: I can not unzip *.gz file

Thu Dec 17, 2015 1:37 pm

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.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

rjobaan
Posts: 53
Joined: Sun Aug 18, 2013 1:07 pm

Re: I can not unzip *.gz file

Thu Dec 17, 2015 7:24 pm

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?

Return to “Beginners”