Skip to content

Instantly share code, notes, and snippets.

@kd7lxl
Created August 3, 2017 17:32
Show Gist options
  • Select an option

  • Save kd7lxl/f3ce8b281936946d633a5a9e6285b3f5 to your computer and use it in GitHub Desktop.

Select an option

Save kd7lxl/f3ce8b281936946d633a5a9e6285b3f5 to your computer and use it in GitHub Desktop.
Detect a change in the route table
#!/bin/bash
PREVTABLE=/tmp/routes
NEWTABLE=$(mktemp)
ip r > "$NEWTABLE"
if [ -f "$PREVTABLE" ]; then
diff -u "$PREVTABLE" "$NEWTABLE"
fi
mv "$NEWTABLE" "$PREVTABLE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment