diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-10-25 21:38:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 21:38:49 +0200 |
commit | 8ec19f0984d16be2db02490127da8fa464151005 (patch) | |
tree | 50ef51a421f0c0094a32191fe1e8922ba59ccb4a /src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient | |
parent | cd6dd608ca83c0af59f7a9937c29bbe445ecfc72 (diff) | |
parent | 393970f9ee5b3dfc58e0e999d3d5941a198b2c6f (diff) | |
download | vyos-1x-8ec19f0984d16be2db02490127da8fa464151005.tar.gz vyos-1x-8ec19f0984d16be2db02490127da8fa464151005.zip |
Merge pull request #1043 from zdc/T3940-sagitta
dhclient: T3940: Added lease file argument to the `dhclient -x` call
Diffstat (limited to 'src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient')
-rw-r--r-- | src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient b/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient index f737148dc..ae6bf9f16 100644 --- a/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient +++ b/src/etc/dhcp/dhclient-enter-hooks.d/02-vyos-stopdhclient @@ -23,10 +23,12 @@ if [ -z ${CONTROLLED_STOP} ] ; then if ([ $dhclient -ne $current_dhclient ] && [ $dhclient -ne $master_dhclient ]); then # get path to PID-file of dhclient process local dhclient_pidfile=`ps --no-headers --format args --pid $dhclient | awk 'match(\$0, ".*-pf (/.*pid) .*", PF) { print PF[1] }'` + # get path to lease-file of dhclient process + local dhclient_leasefile=`ps --no-headers --format args --pid $dhclient | awk 'match(\$0, ".*-lf (/\\\S*leases) .*", LF) { print LF[1] }'` # stop dhclient with native command - this will run dhclient-script with correct reason unlike simple kill - logmsg info "Stopping dhclient with PID: ${dhclient}, PID file: $dhclient_pidfile" + logmsg info "Stopping dhclient with PID: ${dhclient}, PID file: ${dhclient_pidfile}, Leases file: ${dhclient_leasefile}" if [[ -e $dhclient_pidfile ]]; then - dhclient -e CONTROLLED_STOP=yes -x -pf $dhclient_pidfile + dhclient -e CONTROLLED_STOP=yes -x -pf $dhclient_pidfile -lf $dhclient_leasefile else logmsg error "PID file $dhclient_pidfile does not exists, killing dhclient with SIGTERM signal" kill -s 15 ${dhclient} |