Last active
September 10, 2018 20:28
-
-
Save steadystatic/5c0bb0f63a73528ecef40614b135f135 to your computer and use it in GitHub Desktop.
Check vpnc pid file and print online or offline indicator
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
#!/usr/bin/perl | |
# | |
# VPN pid checker to report online or offline in emoji | |
# | |
# Used in tmux prompt so... | |
# a. No warnings desired | |
no warnings; | |
# b. Need to output utf8 for terminal | |
binmode(STDOUT, ":utf8"); | |
# Location of vpnc's pid file when openconnect script started as background daemon | |
$vpn_pid = '/var/run/vpnc/vpnc.pid'; | |
$result = "\x{02705}"; | |
if (!-f $vpn_pid) { | |
$result = "\x{026D4}"; | |
} | |
print STDOUT $result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment