Skip to content

Instantly share code, notes, and snippets.

@gregswift
Last active November 3, 2020 03:45
Show Gist options
  • Save gregswift/bb901138a85984000262914d91d6f3ee to your computer and use it in GitHub Desktop.
Save gregswift/bb901138a85984000262914d91d6f3ee to your computer and use it in GitHub Desktop.
appgate_ps1.sh
source appgate_ps1.sh
# Obviously manage your PS1 however you are gonna mange it... this is just an example
PS1="\u@\h \W \$(__appgate_ps1) $"
# Pull this from https://gist.github.com/gregswift/11ee552bc443e1051eef9454c833c07f
source colorize.bashrc
function __appgate_ps1() {
# Despite not upgrading this went away
#appgate_running=$(ps aux | awk '/enable-dbus=com.appgate.resolver/ && !/awk/ { print "1" }')
#if [ "${appgate_running}" == "1" ]; then
# But this works, at least on linux.. need to figure out crossplatform.
appgate_running=$(ip address show dev tun0 2>/dev/null >/dev/null; echo $?)
if [ "${appgate_running}" == "0" ]; then
COLOR=green
STATUS=⊙
else
COLOR=red
STATUS=⊗
fi
echo $(colorize ${STATUS} ${COLOR})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment