Skip to content

Instantly share code, notes, and snippets.

@muffix
Created November 11, 2019 09:15
Show Gist options
  • Save muffix/a3a14644c8214de0f9f0d9f1150de64e to your computer and use it in GitHub Desktop.
Save muffix/a3a14644c8214de0f9f0d9f1150de64e to your computer and use it in GitHub Desktop.
Script to start/stop/restart the GlobalProtect agent
#!/bin/bash
usage() {
echo "Usage: $0 {start|stop|restart}"
}
start() {
echo "Starting GlobalProtect..."
launchctl load /Library/LaunchAgents/com.paloaltonetworks.gp.pangpa.plist
launchctl load /Library/LaunchAgents/com.paloaltonetworks.gp.pangps.plist
echo "Done!"
}
stop() {
echo "Stopping GlobalProtect..."
launchctl remove com.paloaltonetworks.gp.pangps
launchctl remove com.paloaltonetworks.gp.pangpa
echo "Done!"
}
case $# in
0)
usage
exit 1
;;
1)
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 2
start
;;
*)
echo "'$1' is not a valid verb."
usage
exit 2
;;
esac
;;
*)
echo "Too many args provided ($#)."
usage
exit 3
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment