Skip to content

Commit

Permalink
Now 'ucsf vpn status' reports also on the start time for the 'opencon…
Browse files Browse the repository at this point in the history
…nect' process
  • Loading branch information
HenrikBengtsson committed May 10, 2024
1 parent dc43e59 commit aeb692a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ ucsf-vpn
* Now `ucsf vpn start --debug` and `ucsf vpn stop --debug` reports on
changes to your IP routing table (per `ip route show`).

* Now `ucsf vpn status` reports also on when the OpenConnect process
was started, if it exists.

* Now `ucsf vpn` gives an error if it detects an unknown `--<flag>`
or an unknown `--<key>=<value>` option.

Expand Down
9 changes: 7 additions & 2 deletions bin/ucsf-vpn
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
### * UCSF Managing Your Passwords:
### - https://it.ucsf.edu/services/managing-your-passwords
###
### Version: 5.7.0-9015
### Version: 5.7.0-9016
### Copyright: Henrik Bengtsson (2016-2024)
### License: GPL (>= 2.1) [https://www.gnu.org/licenses/gpl.html]
### Source: https://github.com/HenrikBengtsson/ucsf-vpn
Expand Down Expand Up @@ -453,6 +453,7 @@ function status() {
local -a connected
local method
local oldIFS
local timestamp

assert=$1
mdebug "status() ..."
Expand All @@ -476,7 +477,11 @@ function status() {
msg="No \'openconnect\' process running"
else
connected+=(true)
msg="\'openconnect\' process running \(PID=$pid\)"
timestamp=$(ps -p "${pid}" -o lstart=)
if [[ -n ${timestamp} ]]; then
timestamp=$(date -d "${timestamp}" --iso-8601=seconds)
fi
msg="\'openconnect\' process running \(started on ${timestamp}; PID=$pid\)"
fi
msgs+=("OpenConnect status: $msg")
elif [[ $method == ipinfo ]]; then
Expand Down

0 comments on commit aeb692a

Please sign in to comment.