Sponsored Content
Full Discussion: Changing ip in a custom way
Top Forums UNIX for Dummies Questions & Answers Changing ip in a custom way Post 302342617 by zaxxon on Monday 10th of August 2009 10:25:39 AM
Old 08-10-2009
Cron:
https://www.unix.com/answers-frequent...n-crontab.html

Changing parts of the file; note that I have put another IP address into the "change" file so you notice the difference:
Code:
$> cat orig
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.101.255
IPADDR=192.168.101.91
IPV6INIT=no
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=192.168.101.0
ONBOOT=yes
GATEWAY=192.168.101.1
TYPE=Ethernet
PEERDNS=yes
USERCTL=no
$> cat change
IPADDR=192.168.101.33  <----------------- here is a different number so you notice the difference?!
NETMASK=255.255.255.0
GATEWAY=192.168.101.1
$> awk -F"=" 'NR == FNR {_[$1]=$0; next} _[$1] {print _[$1]; next} $0' change orig
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.101.255
IPADDR=192.168.101.33
IPV6INIT=no
IPV6_AUTOCONF=yes
NETMASK=255.255.255.0
NETWORK=192.168.101.0
ONBOOT=yes
GATEWAY=192.168.101.1
TYPE=Ethernet
PEERDNS=yes
USERCTL=no

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Custom ftp settings

On the standard ftp supplied with Solaris and HP-UX is there anyone that has been able to disable users from certain settings. i.e the put function. Our customer ftp's onto the unix host and gets files for extraction into a pc based spreadsheet. I want to stop them from being able to delete... (1 Reply)
Discussion started by: blp001
1 Replies

2. UNIX for Dummies Questions & Answers

How to custom application name in `ps -ef`?

A program named /usr/bin/aa.sh, two parameters: 11, 22. after start it, the row in `ps -ef` is almost like the following: root 12198 10278 0.0 Nov 25 pts/3 0:00.23 /usr/bin/aa.sh 11 22 but I want to change "/usr/bin/aa.sh 11 22" to one rule string, such as: "AA_11_22", how to... (1 Reply)
Discussion started by: linkjack
1 Replies

3. Shell Programming and Scripting

Changing userID and Changing group and GID

Hello, I want to write a ksh script about changing UID and changing group with GID. There are multiple servers i want to perform that job. linux1 linux2 linux3 linux4 linux5 ...... . . . . . 1.) How can i enter "password" in script rather asking me? I was trying this... ssh... (2 Replies)
Discussion started by: deal732
2 Replies

4. Shell Programming and Scripting

Custom PS command

(0 Replies)
Discussion started by: goldfish
0 Replies

5. Shell Programming and Scripting

Custom auto-complete

Hello: I am using csh, and am a complete noob when it comes to shell scripting. I want the following: 1) Ignore case when doing auto-complete. 2) If there are multiple matches (example: I have files abc.txt abc.txt.1, abc.txt.2 and type abc<tab>), count the number of matches. If... (1 Reply)
Discussion started by: madiyaan
1 Replies

6. AIX

Custom AIX Prompt

In my .profile, my prompt is set like this: set -o vi PS1=`logname`@`hostname -s`:'$PWD>' Is there a way to show what the history number would be of the command I'm typing in the prompt? For example, I frequently run commands then run 'history' to pull up the history number of a command... (2 Replies)
Discussion started by: ptrotter
2 Replies

7. Shell Programming and Scripting

doing own custom parameters

I have an rsync command that I want to create a variable where user can change to customize the parameters. complete rsync command to run: $RSYNC -e 'ssh -ax -o ClearAllForwardings=yes' --log-file=$LOG_FILE --delete -avzcr -u --update $SRC_DIR $USER@$TRG_SRV:$TRG_DIR >> $LOG_FILE What I... (4 Replies)
Discussion started by: abubin
4 Replies

8. Shell Programming and Scripting

custom command

hi I am trying to make my own commands in my linux.I thought a command for changing directories will be easy. I made a simple file amd made the entries #!/bin/bash cd /opt/mydir I then made the file executable and then moved it to /usr/bin. But when i type the script name nothing... (2 Replies)
Discussion started by: born
2 Replies

9. Shell Programming and Scripting

Custom Shell

I have a jump off server, which grants SSH access to a few other servers. I would like to create a custom shell which can be assigned to specific user accounts which runs a menu script upon login, where they can select which server they want to jump too, however should they hit ctrl-c or any... (1 Reply)
Discussion started by: JayC89
1 Replies

10. Shell Programming and Scripting

Custom Report

Hi All, Am getting the raw report from the source and need to prepare the custom report as per the requirement. Requirement keep getting change according to the need. Raw data is as below /* ----------------- test_job_hu ----------------- */ insert_job: test_job_hu job_type: CMD... (4 Replies)
Discussion started by: pradeep84in
4 Replies
IFSCHEME(8)							     Commands							       IFSCHEME(8)

NAME
ifscheme - scheme control for network interfaces SYNOPSIS
ifscheme [-v] [[-s] newscheme] mapping <interface> script ifscheme-mapping DESCRIPTION
ifscheme allows you to change network configuraton schemes or query the current scheme. It integrates with the ifup(8) command and inter- faces(5). For example, you might use this program to configure a "home" scheme and a "work" scheme for a network device on a laptop. When you move between home and work, a simple command can reconfigure your networking. If you run the program with no parameters, it will tell what the current network scheme is. The ifscheme-mapping utility is used to tell the ifup and ifdown utilities about the current scheme. OPTIONS
-v --verbose Run in verbose mode. This is passed in to the ifup and ifdown programs as well. -l --list list all schemes available/defined in /etc/network/interfaces. newscheme -s newscheme --scheme newscheme Change to a new network configuration scheme. When the scheme is changed, network interfaces that were using the old scheme will be taken down and brought back up to use the new configuration scheme. -s or --scheme are mandatory if newscheme begins with a -. CONFIGURATION
To make the program do anything useful when a scheme is selected, you must edit /etc/network/interfaces to add a mapping for the interface (or interfaces) that can be controlled on a per-scheme basis. Suppose you want to control eth0 in this way. You might have an existing eth0 configuraton in there, such as: auto eth0 iface eth0 inet static address 192.168.1.5 netmask 255.255.255.0 gateway 192.168.1.1 To change this so you can chose between static routing and dhcp, replace it with the following (it helps to ifdown the interface first). auto eth0 mapping eth0 script ifscheme-mapping iface eth0-home inet static address 192.168.1.5 netmask 255.255.255.0 gateway 192.168.1.1 iface eth0-work inet dhcp Now if you run "ifscheme home" and ifup the interface, you'll get the eth0-home configuration stanza. If you run "ifscheme work", it will be changed to the eth0-work stanza. You can add additional stanzas as desired, but the label must always be of the form <hardware inter- face>-<scheme name>. If you have a second interface (perhaps a wireless network card on eth1), you can duplicate the above for that interface, changing the eth0 and the configuration details as appropriate, but remember to add an iface stanza for every scheme name for the second interface. FILES
/etc/network/interfaces the interfaces definition file /etc/network/run/scheme the current scheme /etc/network/run/ifstate a record of the current state of the interfaces, managed by ifup and ifdown BUGS
All schemed interfaces will have the same scheme. Any schemed interface which does not have an entry for the current scheme and is not configured when the scheme is changed will not be suc- cessfully configured when it is brought up. SEE ALSO
interfaces(5) ifup(8) ifdown(8) DISTRIBUTION
Redistribution is subject to the GNU public license. AUTHORS
Joey Hess <joey@kitenet.net>, Peter Wilson <pwilson@cs.hmc.edu> IFSCHEME(8)
All times are GMT -4. The time now is 07:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy