Skip to content

Instantly share code, notes, and snippets.

@ffund
Last active August 18, 2016 04:19
Show Gist options
  • Save ffund/d5d3f444ae6112ebd9bdd45cf70b37ec to your computer and use it in GitHub Desktop.
Save ffund/d5d3f444ae6112ebd9bdd45cf70b37ec to your computer and use it in GitHub Desktop.
# Check if nload is installed, install it if not
hasnload=$(dpkg-query -W --showformat='${Status}\n' nload|grep "install ok installed")
if [ "" == "$hasnload" ]; then
sudo apt-get update
sudo apt-get -y install nload
fi
# Check if kernel is too old, and update it if necessary
kernel=$(uname -r | cut -f1 -d'-')
dpkg --compare-versions "$kernel" "lt" "3.19.0"
if [ $? -eq 0 ]
then
# if the $? variable is now equal to zero, our kernel is old
# see http://stackoverflow.com/a/4023880/3524528
sudo apt-get update
sudo apt-get -y install linux-generic-lts-vivid iproute2
sudo /sbin/reboot
fi
# Check if our iproute2 version is old, update if necessary
ipversion=$(ip -V | cut -f2 -d'-')
ipversion="${ipversion/ss/}"
if [ $ipversion -lt 140411 ]
then
sudo wget https://launchpad.net/ubuntu/+source/iproute2/3.14.0-1/+build/5939644/+files/iproute2_3.14.0-1_amd64.deb --output-document=/tmp/iproute2_3.14.0-1_amd64.deb
sudo dpkg -i /tmp/iproute2_3.14.0-1_amd64.deb
fi
# Check if we have the qmonitor script, and download it if not
if [ ! -x /usr/local/bin/queuemonitor ]
then
sudo wget https://git.io/v6KVn --output-document=/usr/local/bin/queuemonitor
# make it executable
sudo chmod a+x /usr/local/bin/queuemonitor
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment