![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| scp automated script | gholdbhurg | UNIX for Advanced & Expert Users | 5 | 10-27-2008 01:23 AM |
| Help needed with automated FTP script | leimrod | Shell Programming and Scripting | 4 | 07-10-2008 08:06 AM |
| i want automated script | arghya_owen | Shell Programming and Scripting | 3 | 06-16-2008 10:02 AM |
| Need help for automated shell script | uneex | Shell Programming and Scripting | 4 | 05-01-2008 01:15 PM |
| help for automated script | splax | UNIX for Advanced & Expert Users | 4 | 12-26-2006 05:36 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|