Sponsored Content
Special Forums IP Networking Automated script to assign TCP/IP settings automatically after unintentionally unplug Post 302284721 by h@foorsa.biz on Friday 6th of February 2009 08:07:04 AM
Old 02-06-2009
Automated script to assign TCP/IP settings automatically after unintentionally unplug

Yesterday i had a situation that cause me headache for a while , I have a web server running win2k3 it has 2 NIC's
one of them assigned to public area network
and the other is not functioning
The place where the server is ,
is messy and cables on the floor so any one can stumble with
cables on the floor and indeed it happened somebody stumbled with the cable and unplugged it form the functioning NIC adapter when s/he returned the cable s/he didn't return it to the right functioning NIC adapter by the way both NIC are enabled
So i made a little trip to place where the server is and begun to do some troubleshooting if you can visualize the situation the unfunction NIC is enabled and it has private ip address so the the icons of connectivity are blinking so i didn't gave care to troubleshoot connectivity after a period i noticed that cable is plugged into the unfunction NIC
so i decided to write a tiny script to handle the situation if someone unplugged the cable and put it and in the unfunction NIC
a college of mine said you could simply assign the other NIC with same TCP/IP settings and he is right and yes its legal to assign same TCP/IP settings to different NIC but it must be disconnected i can do it and make my life much more easier but i decided to automate the process
and write batch script using netsh and automate it as cron job that's all
Code:
(netsh interface show interface | find /i "Local Area Connection" | findstr /B "Enabled" > nul && netsh interface show interface | find /i 
"Local Area Connection" | findstr  "Connected" > nul)
&& (netsh diag ping adapter 1 | find  /I "Reply"  
&& IF %ERRORLEVEL% == 0 echo extra check was successful ) 
|| (echo going to assign TCP/IP settings from a file  & netsh -f c:\location1.txt && echo all is done)

sorry for long
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

help for automated script

Hi ALL: I need to write a script that will start bunch of servers. and these servers each has a sudo account and they need a passowrd. I dont know where to start and look. Can you please give me some hints or some sample code. Thanks in advance. splax (4 Replies)
Discussion started by: splax
4 Replies

2. Shell Programming and Scripting

Need automated shell script please

I'm totally new to shell scripting and I would like to ask your help 1.i want to have a .sh script where it runs opening 2 applications one after another 2.i have 2 applications in /applications/app1 /applications/app2 3. want this script to launch app1 for 20 seconds and get killed... (2 Replies)
Discussion started by: uneex
2 Replies

3. Shell Programming and Scripting

i want automated script

echo "Enter your choice :\c" read num case $num in . 1)"${TEST_HOME}"/ctrl_extract.ksh 1 ;; 2)"${TEST_HOME}"/ctrl_extract.ksh 2 ;;3)"${TEST_HOME}"/ctrl_extract.ksh 3 ;; 4)"${TEST_HOME}"/ctrl_extract.ksh 4 ;; 5)"${TEST_HOME}"/ctrl_extract.ksh 5 ;;... (3 Replies)
Discussion started by: arghya_owen
3 Replies

4. Red Hat

[RHEL4.5] server shutdown when I unplug the ethernet cable

hi.. I unplug my eth0 lan cable.. and suddenly my system shutdown... no idea :eek::confused: (3 Replies)
Discussion started by: flekzout
3 Replies

5. Shell Programming and Scripting

Automated log script

Hello, I am scripting noob but I need little monitoring script. It will be very good if you can help me. What I need: Script will login via ssh to another machine (ssh -l user ipadress), make top command and log first row + machine ip. It should monitor like 10 machines. Script should run... (1 Reply)
Discussion started by: Biosko
1 Replies

6. UNIX for Advanced & Expert Users

TCP Kernel Settings

I have solaris 9 system. I want to change the "tcp_conn_req_max_q" setting in /etc/system. whats the correct way, set ndd:tcp_conn_req_max_q=2048 or set tcp:tcp_conn_req_max_q=2048 thanks (1 Reply)
Discussion started by: chaandana
1 Replies

7. UNIX for Dummies Questions & Answers

how to make script automated

if i have a script called test.sh file1=$(ls -l|awk '{print $9 $1}') awk ' /date_of_selling:/ { print $6 ":" &9 }' /$file1 >> data.txt if i wanna this script to run automatically every day at 8 am :D (3 Replies)
Discussion started by: teefa
3 Replies

8. Solaris

Unplug power from Sparc Server T5440 when in OpenBoot

show /HOST command shows that status = OpenBoot Running when in this state, can the power be unplugged from the server ? we are unable to bring the status to "powered off". Even if we issue "stop /SYS" it will momentarily be in the powered off status and then go back to power on... (1 Reply)
Discussion started by: paulk93
1 Replies

9. Shell Programming and Scripting

Need an automated script

Hi, I need a script to execute below task. As of now I am doing it manually and want it automated. 1)go to below path cd /path/of/file check for the availibility of two file as below of the latest date. test.week1.data test.week2.data Case1. If above files are not present... (3 Replies)
Discussion started by: sv0081493
3 Replies
ESHCONFIG(8)						    BSD System Manager's Manual 					      ESHCONFIG(8)

NAME
eshconfig -- configure Essential Communications' HIPPI network interface SYNOPSIS
eshconfig [-estx] [-b bytes] [-c bytes] [-d filename] [-i usecs] [-m bytes] [-r bytes] [-u filename] [-w bytes] [interface] DESCRIPTION
eshconfig is used to configure device-specific parameters and download new firmware to the Essential Communications RoadRunner-based HIPPI network interface. The interface is very sensitive to the DMA performance characteristics of the host, and so requires careful tuning to achieve reasonable performance. In addition, firmware is likely to change frequently, which necessitates a reasonably easy way to update that firmware. Available operands for eshconfig: -b bytes Adjust the burst size for read (by NIC of host memory) DMA. -c bytes Adjust the burst size for write (by NIC of host memory) DMA. -d filename Filename for file to download into NIC firmware. This must be a file in the standard Essential format, with :04 preceding every line, and a tag line at the end indicating the characteristics of the firmware file. -e Write data to EEPROM. Normally, setting tuning parameters will only persist until the system is rebooted. Setting this parameter ensures that the changes will be written to EEPROM. -i usecs Interrupt delay in microseconds. -m bytes Minimum number of bytes to DMA in one direction (read or write) before allowing a DMA in the other direction. Tuning this prevents one direction from dominating the flow of bytes, and artificially throttling the NIC. -r bytes Bytes before DMA starts for read (from host to NIC). This controls how soon the DMA is triggered; until this many bytes are requested, the DMA will not begin. -s Show statistics for the HIPPI NIC. Repeat the option to suppress non-zero statistics. -t Show current tuning parameters on the host. -u filename Name of file to which the NIC firmware should be uploaded. Not currently supported. -w bytes Number of bytes required before write (from NIC to host) DMA is started. Until this many bytes are ready to be written, the DMA will not start. -x Reset the NIC. This is necessary for the HIPPI-FP support, as ifconfig(8) will no longer physically reset the NIC when the inter- faces goes up and down. Only the super-user may modify the configuration of a network interface. DIAGNOSTICS
Messages indicating the specified interface does not exist or the user is not privileged and tried to alter an interface's configuration. SEE ALSO
esh(4), ifconfig(8) HISTORY
The eshconfig command first appeared in NetBSD 1.4. BSD
June 17, 2005 BSD
All times are GMT -4. The time now is 07:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy