Script to detect dynamic ip change and update to config file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to detect dynamic ip change and update to config file
# 1  
Old 12-26-2012
Script to detect dynamic ip change and update to config file

Hi All,

I am newbie here and request your assistance.

I have a service running on public ip, but since I have a dynamic IP it keeps on changing and every time I need to manually get the new ip and add to the config file and restart the service. This has become bit time consuming.

Hence, I am looking for a script that can do the following action.

Detect IP address in ppp0 whenever it changes -> capture the new IP address and update that to my config file and save -> Restart my service.

Thanking you.
Regards
Shaan
# 2  
Old 12-26-2012
What operating system/distribution? It'd be preferred to put it in your ppp-up script, or ifup scripts if available.
# 3  
Old 12-26-2012
CentOS 5.5

Thank you.
Shaan
# 4  
Old 12-26-2012
Aside from how to invoke it, does the service config really needed changed? Could you possibly listen to 0.0.0.0 and just restart the service?

I don't deal with CentOS but I believe it has an ifup-local script. You could possibly just put service xxx restart in there.

To give details to modify the config file we'd have to know how it looks
# 5  
Old 12-27-2012
Here's the config file. Wherever "PublicIP" appears, I need the ppp0 ip to be updated and save the file. I already have a "Start Service" and "Stop Service" script ready. So only difficulty is how to grab public ip from ppp0 whenever it changes and add that to the place of "PublicIP"

webproxy -l PublicIP -s local:127.0.0.1:7722 -F -L 501 -m 19001 -M 21000 -P PublicIP -B
Setstart -E -n 1 -l PublicIP -l 127.0.0.1 -W PublicIP

---------- Post updated 12-27-12 at 11:22 PM ---------- Previous update was 12-26-12 at 11:28 PM ----------

Any positive feedback from experts..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Update config file using shell script in Solaris 5.10

hi I need to update the value in config.txt value using shell script example: lets say a value in config.txt file is as SEQUENCE=1 after some iteration as the loop ends , the SEQUENCE should get update in the config.txt file with a new value of SEQUENCE=2. also , can anyone please help me... (7 Replies)
Discussion started by: ravidwivedi2288
7 Replies

2. Shell Programming and Scripting

ksh; Change file permissions, update file, change permissions back?

Hi, I am creating a ksh script to search for a string of text inside files within a directory tree. Some of these file are going to be read/execute only. I know to use chmod to change the permissions of the file, but I want to preserve the original permissions after writing to the file. How can I... (3 Replies)
Discussion started by: right_coaster
3 Replies

3. Windows & DOS: Issues & Discussions

script to change widows update permissions

I want to allow windows update when ordinary users are logged on, I'm pretty sure that adjusting the permissions registry entry HEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/WindowsUpdate to allow acces to all domins users does the trick. I already have a logon.bat that runs at... (0 Replies)
Discussion started by: barrydocks
0 Replies

4. Linux

issue on dynamic config script

I have one issue with my existing code.Actually i want to write parameter's at the end of the section not begin of section.please find my code snapshots... while read cfgfilename sectionname parameter do case "$cfgfilename" in cfgfilename) FILE=$HOME/config/$parameter unset... (1 Reply)
Discussion started by: suryanarayan
1 Replies

5. Shell Programming and Scripting

Shell script that will compare two config files and produce 2 outputs 1)actual config file 2)report

Hi I am new to shell scripting. There is a requirement to write a shell script to meet follwing needs.Prompt reply shall be highly appreciated. script that will compare two config files and produce 2 outputs - actual config file and a report indicating changes made. OS :Susi linux ver 10.3. ... (4 Replies)
Discussion started by: muraliinfy04
4 Replies

6. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: www.google.com www.facebook.com www.google.com the output should be: www.google.com x2... (2 Replies)
Discussion started by: ROFL
2 Replies

7. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: (Note: The symbol " was added to stop them being created into links) "www.google.com"... (1 Reply)
Discussion started by: ROFL
1 Replies

8. Solaris

Autosys Config file update on a read-only filer

Hi To All Genius out there, We are running autosys application on solaris 10. In autosys we have a configuration file that contains an Autosys instance configuration data and is located on a NFS filer on which we have a read-only access. Our Autosys environment is on a dual server mode(Active... (0 Replies)
Discussion started by: whn_chips_r_dwn
0 Replies

9. UNIX and Linux Applications

Autosys Config file update on a read-only filer

Hi To All Genius out there, We are running autosys application on solaris 10. In autosys we have a configuration file that contains an Autosys instance configuration data and is located on a NFS filer on which we have a read-only access. Our Autosys environment is on a dual server... (0 Replies)
Discussion started by: whn_chips_r_dwn
0 Replies

10. Shell Programming and Scripting

I wanted to update a script, more dynamic (just say no to hard coding)...

currently it has the following: bdumpN=`ll /home/apps/oracle/admin/DBprod/bdump/DBprod_j* | grep "$Cdate" | wc -l` If I pass the DBname, I would not have to hardcode it in the script... I can capture the database name by adding the following: DBname=$1 The problem is, I have been unable... (2 Replies)
Discussion started by: mr_manny
2 Replies
Login or Register to Ask a Question