[Techtalk] conceptual CVS

Travis Casey efindel at earthlink.net
Fri Jul 18 12:45:53 EST 2003


Friday, July 18, 2003, 11:15:39 AM, Emma Jane Hogbin wrote:

> It sounds like having the central repository on my laptop is a good way to
> deal with file versions. At least I don't think anyone thought it was a
> horrid idea. ;) If I have a sandbox for each of the sites, how do I deal
> with the config files which I need to test the files locally but don't
> want to propogate in each of the sandboxes?

> For example:
>         cfg.php tells the scripts which templates to use
>         connect.php tells the scripts which db to connect to

> I don't want those files being copied from sandbox to sandbox, but it
> would be nice if I could have version control on them and have them
> checked into the repository.

> On Fri, Jul 18, 2003 at 08:07:49AM -0400, Travis Casey wrote:
>> Something that I've done in the past is to use find's ability to find files 
>> newer than a specified file, along with GNU tar's ability to take the list 
>> of files to archive from a file.  For example, a script like this could be 
>> used:

> Unfortunately my config files are in the same directory as the script
> files. (db connect file is in with the other PHP scripts and there are a
> few language-specific interfaces files that are in with the generic
> interface files).

> My feeling is that it would be easier if I had a script that could publish
> targetted files. e.g.
>         publish Quiz.php php/Quiz.php
>         - scp Quiz.php to atlantis and put the file into the subdir php
>         - scp Quiz.php to megatron                      "                       "
>         - scp Quiz.php to xtrinsic                      "                       "

I have a script somewhat like that which I use:

-------------- distrib ------------------------
#!/bin/sh

if [ $# = 2 ] ; then
  where=$2
else
  where=$3
fi

hosts=`cat $1`

for i in $hosts
do
  echo "$i--------------------------- "
  scp $2 ${i}:$where
done
----------------------------------------------

The syntax is:

distrib machinelist file

OR

distrib machinelist file placetoputit

machinelist is a file containing a list of machines to copy to, one
per line.


> I'm usually copying one to five files at a time (rarely more than three
> really) from two different directories.

The above could be modified to take a list of files to copy, and a
directory to copy them to.

For that matter, if you're using different directories on the
different machines, you could put that directory with the machine
names in the file with the list of machines, like so:

--------- file --------------
host1:/home/emma/
host2:/home/hogbin/
host3:/home/ehogbin/
-----------------------------

You'd have to change the scp line in the above to take out the ":",
but that's all you'd have to do.

Making it take a list of files instead of just one shouldn't be too
terribly hard either -- I think you'd assign the $1 to some variable,
then use "shift" to get rid of it, then use $* to get the whole list
of files.  Sorry if that sounds vague... I'm far from being a
scripting expert.  :-)

-- 
Travis Casey
efindel at earthlink.net



More information about the Techtalk mailing list