[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] How to change X-terminales networks

One addition to the sed syntax.  Put single quotes around the


so that it looks like this

to avoid the shell trying to interpret any of the characters.

Do you GNU?
Microsoft Free since 2003--the ultimate antivirus protection!

Rob Owens wrote:
I'm not an expert on the syntax, but I know you can use 'sed' for this.
 It'll find and replace text in any file.  Something like:

sed s/ myconfigfile.txt > myconfigfile.txt.2

That'll find the first IP address in myconfigfile.txt, and replace it
with the 2nd IP address in myconfigfile.txt.2 -- you'll then have to
delete the original config file and replace it with the new one.

You could probably put together a script that does a recursive grep
(grep will find text in a file) and the run sed on that file.  This is
probably wrong, but it might go something like this:


# Change these variables to suit your needs

for FILE in `ls -R $SEARCHDIR`
	grep $OLDIP $FILE
	if [ $? == 0 ]; then
		sed s/$OLDIP/$NEWIP/g $FILE > $FILE.new && mv -f $FILE.new $FILE

I'm very much a beginner at scripting, and I didn't even test this, so
wait and see what the scripting masters on this list say before using
this.  And make sure you test it on a non-production system.


Arturo Limón wrote:

I am preparing a "standar server" for schools with k12ltsp over CentOS.
It runs over Linux RAID, so cloning the server for similar hardware is
quite easy.

BUT, I have a problem with networking. I am preparing the server for
network 192.168.1.x, but when I have to install it in schools, quite
often I find that their network is in the range 192.168.0.x, or
192.168.10.x or any other different from the one I have prepared. As far
as the server will not only server "dumb" terminals (old computers) but
also real computers for services like http, samba, dns, and others, I
may need to change my net range from 192.168.1.x to theirs, better than
changing IPs to serveral tens computers scattered all over the building
(something that they frecuently do not like).

But changing it has proved to be not an easy task. Lots of configuration
files are involved. I have seen all those files are created and/or
correctly configured on installation, but changing them after than needs
a lot of handwork, I have tried with ltspadmin, but I only solves part
of the problem.

So, my question is:

Is there an easy way to "say" to the system, "network is not 192.168.1.x
any more, now is 192.168.0.x", and get all the involved files changed or
recreated accordingly, like in installation happens ?



K12OSN mailing list
K12OSN redhat com
For more info see <http://www.k12os.org>

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the addressee, any disclosure, reproduction,
copying, distribution, or other dissemination or use of this transmission in
error please notify the sender immediately and then delete this e-mail.
E-mail transmission cannot be guaranteed to be secure or error free as
information could be intercepted, corrupted lost, destroyed, arrive late or
incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message which arise as a result of e-mail
transmission. If verification is required please request a hard copy


K12OSN mailing list
K12OSN redhat com
For more info see <http://www.k12os.org>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]