aboutsummaryrefslogtreecommitdiff
path: root/files/bin
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2015-09-18 14:17:05 -0300
committerSilvio Rhatto <rhatto@riseup.net>2015-09-18 14:17:05 -0300
commitd09f347afc0a99481673f227f83864d06206add6 (patch)
tree867eba743474f4d460ade4f2b5e04903f6e4ad17 /files/bin
parent94529422ec6736f9beaa1dc44540645b28925101 (diff)
downloadpuppet-nodo-d09f347afc0a99481673f227f83864d06206add6.tar.gz
puppet-nodo-d09f347afc0a99481673f227f83864d06206add6.tar.bz2
Adds nodo::subsystem::monitor::interface
Diffstat (limited to 'files/bin')
-rwxr-xr-xfiles/bin/ifcheck19
1 files changed, 19 insertions, 0 deletions
diff --git a/files/bin/ifcheck b/files/bin/ifcheck
new file mode 100755
index 0000000..c66f2ad
--- /dev/null
+++ b/files/bin/ifcheck
@@ -0,0 +1,19 @@
+#!/bin/bash
+#
+# Check if a network interface is up, fixing if needed.
+#
+
+# Parameters
+BASENAME="`basename $0`"
+IFACE="$1"
+
+# Syntax check
+if [ -z "$IFACE" ]; then
+ echo "usage: $BASENAME <interface>"
+ exit 1
+fi
+
+# Run
+if ! LANG=C LC_ALL=C ifconfig $IFACE | grep -q "inet addr:"; then
+ ifup --force $IFACE
+fi