summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/templates/reload_dhclient.erb
blob: 075828b781c20f3eda7fe2b7f8f76c2ff699d77c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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