Skip to content

Instantly share code, notes, and snippets.

@isaacgr
Created October 31, 2019 10:27
Show Gist options
  • Save isaacgr/740588afcf46c008c98e2f05862741f1 to your computer and use it in GitHub Desktop.
Save isaacgr/740588afcf46c008c98e2f05862741f1 to your computer and use it in GitHub Desktop.
Restart pci interface to fix dual boot ethernet issue
#!/bin/bash
#Get the PCI-Address of network card (Caution: This works ONLY with ONE NIC)
PCI=`/usr/bin/lspci | /bin/egrep -i 'network|ethernet' | /usr/bin/cut -d' ' -f1`
PCIPATH=`/usr/bin/find /sys -name *\${PCI} | /bin/egrep -i *pci0000*`
#echo "PCI =$PCI"
#echo "PCIPATH=$PCIPATH"
#ls -la $PCIPATH
/usr/bin/logger -t "ResetNIC" "Resetting PCI NIC ${PCIPATH}"
#Reset the PCI Device completely (like Power-ON/Off)
echo 1 >${PCIPATH}/reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment