Shell script to change the ip


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to change the ip
# 1  
Old 03-15-2012
Shell script to change the ip

I am writing a simple DHCP server application that gets ip from a server at boot up ! i wrote a shell script to run the java program that obtains ip from server on another machine...
The problem is when i have obtained the ip i store it in a file ! using awk i retrieve the ip and i'm trying to execute the command ifconfig eth0 x.x.x.x !! as it needs admin privileges it is currently not working.. i need to figure out a way such that at boot up without asking the password the program should run.... please help me!!!
# 2  
Old 03-16-2012
Hi,

have a look at linux init scripts:

https://www.linux.com/learn/tutorial...h-init-scripts

see ya
fra
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script for Auto IP Change

Hi, I am newbie to Linux/Asterisk. I am trying to write a shell script that would look for my SIP trunk registration, if found UNREACHABLE then it would execute a command and check my local IP, if my local IP is 192.168.1.106 then it would change the IP to 192.168.1.150 and vice versa, after... (8 Replies)
Discussion started by: jeetz
8 Replies

2. Shell Programming and Scripting

script to change shell's pwd

Hi there, i was presented with a challenge that is beyond my current shell knowledge: how can you have a script that executed interactive will change your current working directory? Example (under MacOS): 1. start Terminal and my current working directory is my home folder 2. execute a... (3 Replies)
Discussion started by: gigagigosu
3 Replies

3. Shell Programming and Scripting

Shell Script to change a user password using script

Hi Experts, I had tried to executes this script to change the user password through script: No lines in buffer #!/bin/ksh cat /etc/passwd | grep -v userid >> /tmp/pass.tmp1 cat /etc/passwd | grep userid >> /tmp/pass.tmp2 PASS1=`cat /tmp/pass.tmp2 | cut -d ":" -f2` PASS2=`q2w3e4r5` sed... (3 Replies)
Discussion started by: indrajit_renu
3 Replies

4. Shell Programming and Scripting

How to change a directory in shell script?

HI, I need to change the working directory by using the shell script /Export/home/user_name I have to go one step back like /Export/home Please help on this.:confused: (3 Replies)
Discussion started by: thelakbe
3 Replies

5. Shell Programming and Scripting

directory change in shell script

Hi, I am trying to change the directory in my script, & want to check if the directory is present or not . Ex: cd /home/xyz/temp/logs if the logs directory is not present i want to show the error in script instead of shell script error. Can anybody please help me on the same Thx in... (2 Replies)
Discussion started by: vls1210
2 Replies

6. Shell Programming and Scripting

Change the Windows Batch script to UNIX shell script.

Hi, When I run the below script in UNIX it's throwing syntax errors. Actually it's a windows batch script. Could anyone change the below Windows Batch script to UNIX shell script... Script: REM :: File Name : Refresh_OTL.bat REM :: Parameters : %1 - Region REM :: : %2 - Cube Type REM ::... (5 Replies)
Discussion started by: tomailraj
5 Replies

7. Shell Programming and Scripting

Shell script to change a value

I have a shell script that has following entry. MEM_ARGS="-Xms256m -Xmx512m" export MEM_ARGS if ; then if ; then MEM_DEV_ARGS="-XX:CompileThreshold=8000 -XX:PermSize=48m " export MEM_DEV_ARGS fi fi # Had to have a separate test here... (3 Replies)
Discussion started by: rijeshpp
3 Replies

8. UNIX for Dummies Questions & Answers

Change the fonts in the shell script

Hi All, I want to change the font and colour while writing them to a .rtf file using a shell script. How can i do this? Thanks & Regards Dilip (1 Reply)
Discussion started by: DilipPanda
1 Replies

9. Linux

Change directory in a shell script

How do u change ur directory using a shell script?? (12 Replies)
Discussion started by: laxmi
12 Replies

10. Shell Programming and Scripting

script to change shell and prompt

I want to write a shell script which will change the current shell (say from csh to bsh) and my Prompt (say my name) as desired.pls help (1 Reply)
Discussion started by: SHYAM
1 Replies
Login or Register to Ask a Question