cancel
Showing results for 
Search instead for 
Did you mean: 

Backing up cgi-bin

digitl
Grafter
Posts: 27
Thanks: 1
Registered: 31-07-2007

Backing up cgi-bin

Anyone able to offer advice on how to back up the contents of cgi-bin for a newbie please?

Do I use ASCII transfer or binary to download the files to my PC if I've got a mixture of filetypes?

If I need to reinstall the backup do I use ASCII or binary transfer for all the files or do I need to differentiate?

Would I need to CHMOD the files all over again?

TIA.
12 REPLIES
quelquod
Aspiring Pro
Posts: 519
Thanks: 53
Registered: 31-07-2007

Backing up cgi-bin

It depends a bit on what tools you're familiar with, how many files you have, what size they are, how often they change ... There're lots of options. Tell me what tools you use just now to access your ccgi space and I'll give you some ideas.
Bob
Democracy - 3 wolves and a lamb voting about what to have for lunch!
digitl
Grafter
Posts: 27
Thanks: 1
Registered: 31-07-2007

Backing up cgi-bin

Thanks for the response.

I use WS_FTP for file transfer - if that's what you mean...
quelquod
Aspiring Pro
Posts: 519
Thanks: 53
Registered: 31-07-2007

Backing up cgi-bin

Hi
most of the time AFAIK WS-FTP will take care of ascii/binary on its own. You still have to worry about chmodding everything as required when you restore. How many files have you, how large, and how often do they change?

One easyish possibility is to telnet in, tar and zip the whole lot (or selected folders) then use WS-FTP to pull the zip down in binary. This is a bit inefficient if you've a lot of stuff and only a small amount changes though. Very easy to recover the backup though and permissions are retained.
Democracy - 3 wolves and a lamb voting about what to have for lunch!
digitl
Grafter
Posts: 27
Thanks: 1
Registered: 31-07-2007

Backing up cgi-bin

Hi

29 files in 7 folders amounting to around 194KB, none of which changed very often.

I know how to telnet - woo! At least I think I do - Start -> Run -> telnet ccgi.force9.net?

If I knew how to 'tar and zip the whole lot' then that would be preferable, I think. Do you know of a tutorial?
quelquod
Aspiring Pro
Posts: 519
Thanks: 53
Registered: 31-07-2007

Backing up cgi-bin

OK, telnet in as you say above and log in with your username and password. Stay in your root folder.

At the prompt type:
tar -cvf 'your_filename' *
gzip 'your filename'

This will create a zipped tar of your whole area (the first command will list all files as it goes. The second will zip it into 'your_filename.gz'.) Download this in binary as your archive.

To recover the backup first upload it in binary to wherever it came from (your root folder). Then telnet in and do the following:
gunzip 'your_filename.gz'
tar -xvf 'your_filename'
Any files of the same name will be overwritten. Any others won't be touched.

If you want to backup just a single folder replace the * in the first command with the relevant folder name.

This is rather frowned on by purists but it's probably ok for what you want. Note however that this simple procedure doesn't archive 'hidden' files, ie those beginning with a '.'. This is because it would otherwise try to archive the parent folder (../) etc. If you have hidden files you need to archive let me know.
Bob
Democracy - 3 wolves and a lamb voting about what to have for lunch!
N/A

Backing up cgi-bin

I'd suggest that you put this into a script, and then use crontab (there's info on the help to do that) to call the script.
Perhaps get it to mail you the contents every other day.... perhaps create a mailbox specifically to pick up these files??

Ed
digitl
Grafter
Posts: 27
Thanks: 1
Registered: 31-07-2007

Backing up cgi-bin

That sounds like a good idea! Thanks.

Sounds like I've got a lot to learn!
Community Veteran
Posts: 4,729
Registered: 04-04-2007

Backing up cgi-bin

For a simple backup scrip that can be used on the f9 cgi server and run from cron see;
www.chillypenguin.org

Chilly
David_W
Rising Star
Posts: 2,293
Thanks: 29
Registered: 19-07-2007

Backing up cgi-bin

hi Chilly, nice script! How would you go about altering it so that it will only send off changed files and not delete the original backup?

Also, how would you set it to backup the entire site? (except naturally the tar file itself). Every time I've tried tar -czf backup.tar.gz * its either been an incomplete backup, or bottomed out with an error >.<
JonathanW
Grafter
Posts: 2,648
Registered: 02-10-2007

Backing up cgi-bin

This might help you, its taken from the backup script that I run, the full version can be found here

$basepath should be the directory that you want to start the archive off in, so it would be something like /files/homeX/username

tar --exclude backup.tar.gz -czf backup.tar.gz $basepath
David_W
Rising Star
Posts: 2,293
Thanks: 29
Registered: 19-07-2007

Backing up cgi-bin

I tried to uncompress the archive after downloading, winrar reports the archive is corrupt, thats using both the command you showed, and also the script, is my cgi space broke? :?
Community Veteran
Posts: 4,729
Registered: 04-04-2007

Backing up cgi-bin

Try uploading back into a temporary directory on the CGI server and untar’ing there.

Chilly