Created
November 11, 2019 09:15
-
-
Save muffix/a3a14644c8214de0f9f0d9f1150de64e to your computer and use it in GitHub Desktop.
Script to start/stop/restart the GlobalProtect agent
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/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