Sponsored Content
Special Forums UNIX and Linux Applications [solved]Moving server...need to find all hard code IP references Post 302722381 by scasey on Friday 26th of October 2012 11:15:57 PM
Old 10-27-2012
[solved]Moving server...need to find all hard code IP references

I'm moving my web server to a different datacenter.
OS is CentOS 5.8
Apache 2.2.3
qmail
NcFTPd

Its been 12 years since I relocated a server. Lots of brain cells lost since then...:-)

I need to identify all the config files that contain the server's IP addresses. Memory has provided these:
Network - /etc/sysconfig/network-scripts/* (duh)
httpd.conf
sshd_config
NcFTPd *.cf files
resolv.conf
named.conf

Q: Does anyone see anything I'm missing and/or is there a way to search all files on the server for the old IP addresses?

TIA for any assistance.

Sean

Update: Nothing like getting some sleep...ran this from the command line and got a list of all config files that contained the ip addresses:
Code:
rm -f junk
for FILE in `grep "# config:" /etc/init.d/* | sed "s/^.*# config://"`
do 
if [ -e $FILE ] 
then
echo -n "$FILE " >> junk
grep -c 206.169 $FILE >> junk
fi
done
grep -v 0 junk

This "script"
Scans files in /etc/init.d for the names of configuration files
Checks to see if the config file exists, if yes
Output the file name
grep --count for the number of times the IP is found in the file, writing to a temp file
grep for lines that do not contain a 0 count.
Resulting in...
Code:
/etc/dovecot.conf 3
/etc/httpd/conf/httpd.conf 78
/usr/local/etc/ncftpd/general.cf 1
/usr/local/etc/ncftpd/domain.cf 1
/etc/ssh/sshd_config 2

It doesn't find config files that aren't referenced in /etc/init.d, of course, but it did catch a couple I'd missed.

Last edited by scasey; 10-27-2012 at 03:03 PM.. Reason: Solved
 

9 More Discussions You Might Find Interesting

1. Programming

how can compile cpp code containing references to java classes

hi there is example (on link given below )of such code that contains java class reference in c++ program. http://slackware.cs.utah.edu/pub/slackware/slackware-7.1/docs/Linux-HOWTO/Process-Monitor-HOWTO I am new in linux environment. and not able to compile it. when i compile it through... (1 Reply)
Discussion started by: surinder
1 Replies

2. Shell Programming and Scripting

Using grep and regular expression to find class references in a c++ file

I'm trying to math all class references in a C++ file using grep with regular expression. I'm trying to know if a specific include is usuless or not, so I have to know if there is a refence in cpp. I wrote this RE that searches for a reference from class ABCZ, but unfortunately it isn't working... (0 Replies)
Discussion started by: passerby
0 Replies

3. Shell Programming and Scripting

How to use grep & find command to find references to a particular file

Hi all , I'm new to unix I have a checked project , there exists a file called xxx.config . now my task is to find all the files in the checked out project which references to this xxx.config file. how do i use grep or find command . (2 Replies)
Discussion started by: Gangam
2 Replies

4. Shell Programming and Scripting

[SOLVED] moving multiple files? mv

HI I have a list of files that are incorrectely names and I need to move them to new name .. I tried few things that has not worked so far can you help ? I need to rename all thes eifle ( tere are over 100 ) xldn0357bap.orig.new xldn0389bap.orig.new xldn0439bap.orig.new... (12 Replies)
Discussion started by: mnassiri
12 Replies

5. HP-UX

[Solved] D380/2 hard drive

Hello everybody, I've received yesterday a very old HP server: HP9000, A3579A, D380/2 with two 180 MHz PA-RISC CPUs, 256 MB RAM. Actual firmware is 38.40. But no hard drives. I'm looking for 18 or 36 GB HD references. Is 11i v3 HP-UX working on it? Or, what is the latest version? Is 256 MB... (4 Replies)
Discussion started by: Citroen
4 Replies

6. Shell Programming and Scripting

Difficulty cleaning references to duplicated images in HTML code

Hi, I need to search and replace references to duplicated images in HTML code. There are several groups of duplicated images, which are visually the same, but with different filenames. I managed to find the duplicated files themselves, but now I need to clean the code too. I have a CSV file with... (9 Replies)
Discussion started by: mdart
9 Replies

7. Hardware

[solved] Sun Netra X1 - Adding a Second Hard Drive

As the title suggests, I'm trying to install a second drive (really want an OS mirror) on a Sun Netra X1. I've taken the spacer out, and had a go at with the drill-press so now I have a nice HDD tray. Have installed an IDE drive in the tray, plugged in the power and data cables that were... (0 Replies)
Discussion started by: Smiling Dragon
0 Replies

8. SCO

Moving hard drive and SCSI adapter to another computer

OK group, it's been 12 years since I worked with SCO. I need some direction here: SCO Openserver 5.07 I have a server with a bad motherboard. I have moved the SCSI adapter and hard drive to another computer. This new server has different hardware so I must install the chipset drivers for... (1 Reply)
Discussion started by: jscholz
1 Replies

9. Linux

Need suggestions or references to find a way to get free Linux on Windows

Hi all, I am sorry if this is a repetitive question and would be happy if I get directed to a source where I can find details about this. I have a laptop with windows 8, 8 GB RAM and 1 TB hard disk with most of the memory available for use. I am trying to find a good option to install Linux... (8 Replies)
Discussion started by: pat_pramod
8 Replies
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 07:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy