So I have a server I am trying to set up a script to send a Wall message notifying of my eth0 nic being set to 100 half duplex instead of 100 full duplex.
I know I am trying to read from /etc/sysconfig/network/ifcfg-eth0 to pull the parameters
yes, speed and duplex only. Auto-negotiate on is also something I am looking for but at the very least, 100 full duplex.
The reason is I have a few servers that have mysteriously switched settings to 100 half. I don't care how they changed, I just need to know asap so as to correct the condition before network communications get too out of hand.
This is just the starting point I need. Thank you so much! I'll plug in the parameters I need and post the results!
---------- Post updated at 01:22 PM ---------- Previous update was at 11:30 AM ----------
Pardon my lack of knowledge here but I seem to be getting syntax errors with the "fi" at the end of the file? I tried running the dos2linux command to ensure there are no weird characters at the end of the file. Am I missing something within?
starbuck:/home/acc4000d # ./duplex72
./duplex72: line 8: syntax error near unexpected token `fi'
./duplex72: line 8: `fi'
#!/bin/sh
DUPLEX=$(ethtool eth0 | sed -n 's/Duplex:\(.*\)/\1/p')
if [ $DUPLEX = Full ]
then
echo "All is good in the neighborhood"
elif [ $DUPLEX = Half ]
echo "Check eth0 settings, I am at 100 half duplex. Do IT NOW!!!"
fi