[CentOS] Re: Kernel 2.6.18-53.1.13.el5 fails on network.

Steven Haigh netwiz at crc.id.au
Thu Feb 14 18:26:25 UTC 2008


Just replying to myself for this - I realised that after a 'failed' boot, it
would also overwrite the boot logs when the system came back up with the
correct kernel/grub config ;)

I've made a few changes and added a bit more to the script - and I think its
about ready to use.

----------------------- Begin script ---------------------
#!/bin/bash
sleep 30

# Gather some system info:
echo "System booted at `date`." > /root/bootinfo
cat /proc/version >> /root/bootinfo
echo "------ Dmesg start ------" >> /root/bootinfo
dmesg >> /root/bootinfo
echo "------ lsmod start ------" >> /root/bootinfo
lsmod >> /root/bootinfo
echo "------ ifconfig start ------" >> /root/bootinfo
ifconfig >> /root/bootinfo
echo "------ route info ------" >> /root/bootinfo
route -n >> /root/bootinfo
echo "------ mii-tool start ------" >> /root/bootinfo
mii-tool -v eth0 >> /root/bootinfo
echo "------ mounted drives ------" >> /root/bootinfo
mount >> /root/bootinfo
echo "------ Disk space ------" >> /root/bootinfo
df -h >> /root/bootinfo
echo "------ End troubleshooting ------" >> /root/bootinfo

# Test if we have network connectivity.
ping -c 1 -n <gateway> > /dev/null
if [ $? -eq "0" ]; then
  # We can ping the gateway!
  echo "Network ok."
  exit 0
else
  # We have no network connectivity :(
  echo "No Network!"
  mv /root/bootinfo /root/bootinfo.failed
  cp -f /etc/grub.conf-good /etc/grub.conf
  reboot
fi


--
Steven Haigh

Email: netwiz at crc.id.au
Web: http://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897




More information about the CentOS mailing list