Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Change IP on a server
PostPosted: Fri Aug 21, 2009 1:56 am 
Offline
Senior Newbie

Joined: Thu Aug 20, 2009 5:24 am
Posts: 13
Hi Forum,

i'm forwarding, as requested, here, what i've asked in a ticket:

Quote:
Tom, do you know how can i change the IP EVERYWHERE on my server? If i use a standard recursive "sed" -see above-, it will substitute al symlinks with static files.

#!/bin/sh
grep -rl OLDIP ./ |
while read filename
do
(
echo "Editing: $filename"
sed -i "s/OLDIP/NEWIP/g;" $filename
)
done

This is just because the initial grep, also searches in symlinks:

SRV:/etc/apache2/sites-enabled# grep -rl OLDIP ./
./00_master.conf
./ispcp.conf
SRV:/etc/apache2/sites-enabled#

As you can see, those files are symlinks:

SRV:/etc/apache2/sites-enabled# ls -lha
total 8.0K
drwxr-xr-x 2 root root 4.0K Aug 4 12:18 .
drwxr-xr-x 8 root root 4.0K Aug 4 12:15 ..
lrwxrwxrwx 1 root root 33 Aug 4 12:18 00_master.conf -> ../sites-available/00_master.conf
lrwxrwxrwx 1 root root 29 Aug 4 12:18 ispcp.conf -> ../sites-available/ispcp.conf
SRV:/etc/apache2/sites-enabled#

Any idea?


Have you ever done something similar?

Thankyou!

EDIT:

Found this in your documentation, but still have the same problem!

find ./ -type f -exec sed -i 's/98\.76\.54\.32/12\.34\.56\.78/' {} \;


Top
   
 Post subject:
PostPosted: Fri Aug 21, 2009 11:44 am 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
Quote:
find ./ -type f -exec sed -i 's/98\.76\.54\.32/12\.34\.56\.78/' {} \;
.

That should not affect symlinks. Did you forget to change the normal files from your previous attempts back into symlinks?


Top
   
 Post subject:
PostPosted: Mon Aug 24, 2009 3:29 am 
Offline
Senior Newbie

Joined: Thu Aug 20, 2009 5:24 am
Posts: 13
Quote:
That should not affect symlinks. Did you forget to change the normal files from your previous attempts back into symlinks?


Thankyou, i'll try.

I've completely restored my system :D

Good, I confirm, it works:

Quote:
SRV:/etc/apache2/sites-enabled# ls -lha
total 8.0K
drwxr-xr-x 2 root root 4.0K Aug 4 12:18 .
drwxr-xr-x 8 root root 4.0K Aug 4 12:15 ..
lrwxrwxrwx 1 root root 33 Aug 4 12:18 00_master.conf -> ../sites-available/00_master.conf
lrwxrwxrwx 1 root root 29 Aug 4 12:18 ispcp.conf -> ../sites-available/ispcp.conf
SRV:/etc/apache2/sites-enabled# find ./ -type f
SRV:/etc/apache2/sites-enabled#


Maybe i've done something wrong in the initial test.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group