Skip to content

Instantly share code, notes, and snippets.

@rabin-io
Last active October 23, 2018 20:08
Show Gist options
  • Save rabin-io/508fefb7a08a10d307af77d13839b34e to your computer and use it in GitHub Desktop.
Save rabin-io/508fefb7a08a10d307af77d13839b34e to your computer and use it in GitHub Desktop.
88-MASTER-DISPATCHER
#!/bin/bash
[[ -z ${CONNECTION_UUID} ]] && exit 0
DEVICE=${1}
STATE=${2}
CWD=$(dirname "$0")
LOG='/var/log/NetworkManager_dispatcher.d.log'
# DEBUG
echo "$(date +"%F %T") Called with ($*) and connection uuid is: ${CONNECTION_UUID}" >> ${LOG}
# Needed only if you need to display notification popups
#export DISPLAY=:0.0
#export $(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep session)/environ)
for FILE in ${CWD}/${CONNECTION_UUID}/${STATE}/*
do
#DEBUG
echo "$(date +"%F %T") Running ${FILE}" >> ${LOG}
. "${FILE}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment