Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Site development hint - copy links tree

Quote Reply
Site development hint - copy links tree
If you've wanted to create a copy of your Links directory (cgi-bin stuff) so you can work on it without killing off your main site, you know this can be somewhat difficult, especially on Unix, where you need to get all the file permissions right. It can be maddening. Here are instructions to set up a new copy of the Links files (using the _SAME_ database) so you can play with the HTML, output, etc, without killing off your main site. You then just need to copy the changes to your live site.

There is an easy way to do it, using tar and a | (pipe)

For this, assume your /cgi-bin/Links dir is where you have it. You want to create a cgi-bin/Links_test dir.

First, cd to your /cgi-bin directory. Then:

mkdir Links_test

Then,

cd Links

Then,

tar cf - ./* | (cd ../Links_test ; tar xvBpf - )

[[This command tars the directorys, including file permissions, changes to the test directory, then un tars it all in one]]

Your tar command _may_ be a bit different, this is the Solaris version, there are minor flag differences for some.

Then, cd to your new directory, and make sure the file permissions are all right.

NOTE #1 -- you now need to edit your Links.pm file to reflect the new path names (otherwise your output will go to your "live" site), and you need to create a new /public/html (or whatever) directory tree to handle the output (I just changed the 'Links' in the Links.pm file to 'Links_test' in all the path names). You _DO_NOT_ need to change the .def files if you want to use the main database (this is for testing new HTML, templates, minor code changes, etc where the database records are not going to be affected.) If you think you will be doing dangerous things to the Links database itself, you need to create a new one (that is beyond the scope of this message).

NOTE #2: there is _NO_ error checking on this. The biggest mistake is not making the destination directory first. If you are doing this as "you" and not as "root" you really can't do too much damage to anything. If you specify the wrong place, the output is just lost. I _STRONGLY_ suggest _NOT_ doing this as anything but the Links user.

This is based on a SysAdmin trick for moving home directories from one place to another.

Do it as "root" at your own risk!!!

I used the EXACT above command to create my new test directory, so I know it works on Solaris 7.

I guess this qualifies as a "stupid Links trick" or something like that <G>. Might be of use to some people -- does save a lot of time on all the permissions though.

------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/