summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/templates
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-06-19 15:54:59 -0400
committerMicah Anderson <micah@riseup.net>2013-06-19 15:54:59 -0400
commit8259e18e06fe1535ad931e4c45dfe2583443f162 (patch)
tree4f8ff484d30f76fb76470d9f6148ed844b3715f2 /puppet/modules/site_config/templates
parente66040d2180546541bd075ebc40548f3c8de87f4 (diff)
parent16b2a5593ce4ced4a21635b0638147bff250d13f (diff)
Merge branch 'develop' into leap
Diffstat (limited to 'puppet/modules/site_config/templates')
-rw-r--r--puppet/modules/site_config/templates/reload_dhclient.erb13
1 files changed, 13 insertions, 0 deletions
diff --git a/puppet/modules/site_config/templates/reload_dhclient.erb b/puppet/modules/site_config/templates/reload_dhclient.erb
new file mode 100644
index 00000000..882c985a
--- /dev/null
+++ b/puppet/modules/site_config/templates/reload_dhclient.erb
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# Get the PID
+PIDFILE='/var/run/dhclient.<%= scope.lookupvar('site_config::params::interface') %>.pid
+
+# Capture how dhclient is currently running so we can relaunch it
+dhclient=`/bin/ps --no-headers --pid $(cat $PIDFILE) -f | /usr/bin/awk '{for(i=8;i<=NF;++i) printf("%s ", $i) }'`
+
+# Kill the current dhclient
+/usr/bin/pkill -F $PIDFILE
+
+# Restart dhclient with the arguments it had previously
+$dhclient