Skip to content

Instantly share code, notes, and snippets.

@Ara4Sh
Last active August 4, 2022 09:30
Show Gist options
  • Save Ara4Sh/6e4b40bbb2311e608ba91774e9ee9366 to your computer and use it in GitHub Desktop.
Save Ara4Sh/6e4b40bbb2311e608ba91774e9ee9366 to your computer and use it in GitHub Desktop.
#! /bin/sh -u
networksetup -listallnetworkservices | awk 'NR>1' | while read SERVICE ; do
if networksetup -getautoproxyurl "$SERVICE" | grep '^Enabled: Yes' >/dev/null; then
networksetup -setautoproxystate "$SERVICE" off
sleep 2
networksetup -setautoproxystate "$SERVICE" on
echo "$SERVICE" bounced.
fi
done
@animatedcreativity
Copy link

I had to add sleep after ON/OFF to make it work.
sleep 2

@Ara4Sh
Copy link
Author

Ara4Sh commented Aug 4, 2022

@animatedcreativity thanks, I updated the snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment