Skip to content

Instantly share code, notes, and snippets.

@sebastianwagner
Last active August 29, 2015 14:17
Show Gist options
  • Save sebastianwagner/2b1f02c689121427b5ba to your computer and use it in GitHub Desktop.
Save sebastianwagner/2b1f02c689121427b5ba to your computer and use it in GitHub Desktop.
Network Manager disconnect script for docker devices
#!/bin/sh
##
# @see https://github.com/jpetazzo/pipework/issues/72#issuecomment-50045428
##
which nmcli
if [ $? -eq 0 ]; then
LANG=C nmcli --terse --fields device,state device status \
| egrep "^(docker|vboxnet).*\:connected" \
| cut -d ':' -f 1 \
| xargs --no-run-if-empty --max-args=1 nmcli device disconnect
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment