summaryrefslogtreecommitdiff
path: root/puppet/modules/site_config/templates/reload_dhclient.erb
blob: 882c985a3e70968d1832a9aff8c1d8e9f9d82e62 (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