07-22-2008
Need help: Script to edit the hosts, network and eth0 file
Hello all
I am new to scripting. I need somebody to help me write a script that can edit the files.
For eg: if i say ./script <ipadd> <hostname>
then it should change the ipaddress and hostname in the following files:
1. /etc/hosts
2. /etc/sysconfig/network
3. /etc/sysconfig/network-scripts/ifcfg-eth0
I have just started scripting so any help would be greatly appreciated.
Thanks all in advance.
Cheers
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
have edit the /etc/hosts as belows
123.45.12.55 mypc
so when i do a who, i can see my "mypc" BUT after i changed, i cant see "mypc"
do i have to restart anything? (6 Replies)
Discussion started by: yls177
6 Replies
2. Shell Programming and Scripting
Hello,
How would i go about editing a file using VI within a shell script please?
Basically, i want to open a file, clear it's contents and save the file.
I found this on the web using "ex" but can't seem to get it to work:
ex /home/oconnor/TOOLS/UNIXCMDS/test_ex <<eof_ex
dd /*i put... (2 Replies)
Discussion started by: bobk544
2 Replies
3. Red Hat
hi,
i would like to share this
/etc/sysconfig/network-script/route-eth0
GATEWAY0=XXXXXX
NETMASK0=XXXXXX
ADDRESS0=XXXXXXX
a delete route command with "route del -net xxxx...." will work but if the above exist and you reboot the linux then old route will be invoke on that config-route.
... (0 Replies)
Discussion started by: itik
0 Replies
4. Red Hat
Ok Time warner cable / voip modem feeding Cisco PIX 501 Wan port from PIX 501 LAN port to WAN port on Linksys wrt54GL wireless router.
so
-->Modem-->PIX 501-->WRT54GL-->Linux Server, wireless desktop, wireless laptop (2), Wireless MAC Pro, Wireless Apple TV, Wireless printer.
my... (0 Replies)
Discussion started by: tedeansiii
0 Replies
5. Red Hat
Hi All,
Could anyone please help to resolve the below problem.
I installed RHEL5.5 in my desktop.But when i try to activate the ethernet connection then it gives me the error.
I spent 2 days for the above and go through with several suggestion found by googling. But no luck.
... (0 Replies)
Discussion started by: Tanmoy
0 Replies
6. Shell Programming and Scripting
I have about 500 hosts where I need to ssh by sending the password on the command line or in a text file in a clear text . However I am not able to download "sshpass" or other tools .
Any other ways to pass the password in a script ? (3 Replies)
Discussion started by: gubbu
3 Replies
7. IP Networking
ello,
i am new to the networking side.
I have a requirement to check the tcp network connectivity between server it's running on and the list of host's and ports combination.
please help me where i am going wrong.
my code:
#!/bin/bash
#read the file line by line
cd "$1"
cat... (17 Replies)
Discussion started by: sknovice
17 Replies
8. UNIX for Advanced & Expert Users
i wrote script for if file exists script do file edit problem with the script get stuck not existing as for exit i mentioned exit 0 , and how to give the exception for script it should add
./script -- add hi
./script --add "hi how are you"
now below script with case it is working for... (0 Replies)
Discussion started by: markjohn1
0 Replies
9. Linux
I have created a bridge with nmcli between eth0 and wlan0
I use this procedure
sudo nmcli con add ifname br0 type bridge con-name br0
sudo nmcli con add type bridge-slave ifname eth0 master br0
sudo nmcli con add type bridge-slave ifname wlan0 master br0
sudo nmcli con modify br0... (1 Reply)
Discussion started by: Linusolaradm1
1 Replies
10. Solaris
Am trying to copy a tar file onto a series of remote hosts and untar it at the destination. Need to do this without having to do multiple ssh.
Actions to perform within a single ssh session via shell script
- copy a file
- untar at destination (remote host)
OS : Linux RHEL6 (3 Replies)
Discussion started by: sankasu
3 Replies
LEARN ABOUT SUSE
smpppd-ifcfg
SMPPPD-IFCFG(8) SMPPPD SMPPPD-IFCFG(8)
NAME
smpppd-ifcfg - SuSE Meta PPP Daemon
DESCRIPTION
smpppd-ifcfg is a daemon that controls a single dialup connection to the internet. It does so by starting and controlling the pppd. The
configuration of the dialup connections is done by YaST2.
smpppd-ifcfg is not intended for direct use. Use ifup and ifdown or a frontend like cinternet , qinternet or kinternet instead.
OPTIONS
These options are recognized by smpppd-ifcfg. If a long option shows an argument as mandatory, then it is mandatory for the equivalent
short option also.
--up Bring the connection up. This is the default action.
--down Bring the connection down.
--status
Report status of the connection.
-i, --ifcfg=NAME
Specify the ifcfg file to use. This option is mandatory.
-p, --provider=NAME
Specify the provider file to use.
--detach
Detach from the controlling terminal. This is the default.
--nodeatch
Don't detach from the controlling terminal.
-d, --debug
Turn on debugging.
--version
Show program version and exit.
--help Show help information and exit.
FILES
/etc/sysconfig/network/ifcfg-*
Configuration files for the interfaces.
/etc/sysconfig/network/providers/*
Configuration files for the providers.
/var/log/smpppd/ifcfg-xxx.log
Log file.
/var/log/smpppd/accounting.log
File containing accounting information.
/var/run/smpppd.ifcfg-xxx.pid
Pid file.
/var/lib/smpppd/ifcfg-xxx.info
Info file with various status information.
/var/run/smpppd/ifcfg-xxx
Socket to communicate with smpppd.
SEE ALSO
kinternet, qinternet, cinternet(1), accounting(1), wvdial(1), smpppd.conf(5), pppd(8), smpppd(8).
AUTHOR
Arvin Schnell <arvin@suse.de>
SuSE December 2002 SMPPPD-IFCFG(8)