RE: Re: Kernel 2.6.18-53.1.13.el5 fails on network.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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@xxxxxxxxx
Web: http://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux