0

In trying to back up a website on an apache server this am I ran the following:

gzip -r /var/www/httpd/vhosts/mysite.com/ mysite.gzip

Trying to backup the path to the gzip file. Howvever, after completeion i go to the website url and get the apache welcome screen.

What happened? Is there a way to easily reverse this?

Thank you very much for any help!

Martin
  • 1

3 Answers3

1
for file in `find /var/www/httpd/vhosts/mysite.com/`; do gunzip $file; done

You gziped everything in your htdocs root into file.gz file2.gz and it probably errored when it didn't find the file.gzip

Mike
  • 21,910
  • 7
  • 55
  • 79
  • +1 - better answer than mine. I saw that he'd got the arguments the wrong way around but didn't realise it would have globbed it. He may have gzipped the directory rather than everything in it? – James L Nov 10 '10 at 18:43
  • Thank you, apparently it didn't create the file mysite.gzip but instead just replaced all of the files with gzip versions of themselves. Is there a way to reverse that? – Martin Nov 10 '10 at 18:45
  • my command will reverse it for all the files – Mike Nov 10 '10 at 18:47
  • is there any chance I can unzip those Mike? – Martin Nov 10 '10 at 18:48
  • His command is in the answer. – James L Nov 10 '10 at 18:49
  • This command: gunzip $file that gives me /../ is a directory ignored – Martin Nov 10 '10 at 18:49
  • That's probably done it, but if not, try: `find /var/www/httpd/vhosts/site.com/ -name \*.gz -exec gunzip '{}' \;` – James L Nov 10 '10 at 18:50
  • you are not running the WHOLE COMMAND.. its starts with for.. ends with done – Mike Nov 10 '10 at 18:51
  • @Martin For future reference, gzip only compresses **one file at a time**. If you want to archive the entire directory into a single file, use `tar czf file.tar.gz /var/www/httpd/vhosts/mysite.com/` and be sure you have the .tar.gz file first because tar will happily overwrite whatever file you tell it to archive everything in. – DerfK Nov 10 '10 at 18:51
  • That last command looks to be doing it. Thank you soooo much. – Martin Nov 10 '10 at 18:55
  • Thanks mike, I get what you mean now. James' command looks to be working as well. – Martin Nov 10 '10 at 18:58
0

You got your arguments the wrong way around. What's the output of ls -al /var/www/httpd/vhosts/mysite.com/? It might not be a big issue.

James L
  • 5,915
  • 1
  • 19
  • 24
  • It lists the contents of the directory. – Martin Nov 10 '10 at 18:47
  • I know what the command does, I asked for the output not the purpose of the command. Basically I wanted to know what was still in the directory, but see @Mike's answer. – James L Nov 10 '10 at 18:48
-1

I know it's too late, but maybe type "man gzip" before running the command?

  • To be fair, man gzip isn't too helpful. There's no examples for basic usage and it only states "gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name ... ]" which isn't obvious. – James L Nov 10 '10 at 18:47