Last active
May 29, 2016 18:15
-
-
Save mrbuk/b0cfa31bb73e63720e335cbe46e04720 to your computer and use it in GitHub Desktop.
Refresh PAC by disabling/enabling proxy state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
read -r -d '' script << _EOF_ | |
networksetup -listallnetworkservices | awk 'NR>1' | while read SERVICE ; do | |
if networksetup -getautoproxyurl "\$SERVICE" | grep '^Enabled: Yes' >/dev/null; then | |
networksetup -setautoproxystate "\$SERVICE" off | |
networksetup -setautoproxystate "\$SERVICE" on | |
echo "\$SERVICE" bounced. | |
fi | |
done | |
_EOF_ | |
echo "$script" | sudo sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment