Created
May 28, 2019 12:51
-
-
Save kushal-r/2ca8592745bb2b3db8600ad2092a3e89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # relaunch with sudo if we aren't root | |
| if [[ $EUID -ne 0 ]]; then | |
| echo "$0: relaunching as sudo $0 $1 $USER" | |
| sudo "$0" $1 $USER | |
| exit $? | |
| fi | |
| real_user=$USER | |
| if [ -n "$2" ]; then | |
| real_user=$2 | |
| fi | |
| stop() { | |
| echo $0: unloading bluecoat daemon | |
| launchctl unload /Library/LaunchDaemons/com.bluecoat.ua.*plist | |
| echo $0: closing bluecoat UI widget as $real_user | |
| sudo -u $real_user launchctl unload /Library/LaunchAgents/com.bluecoat.ua.notifier.*plist | |
| } | |
| start() { | |
| echo $0: loading bluecoat daemon | |
| launchctl load /Library/LaunchDaemons/com.bluecoat.ua.*plist | |
| echo $0: launching bluecoat UI widget as $real_user | |
| sudo -u $real_user launchctl load /Library/LaunchAgents/com.bluecoat.ua.notifier.*plist | |
| } | |
| case "$1" in | |
| start) | |
| start | |
| ;; | |
| stop) | |
| stop | |
| ;; | |
| *) | |
| echo "Usage: $0 [start|stop]" | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment