Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'pivpn clients' command to show list of connected clients
- Loading branch information
Showing
5 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
# PiVPN: client status script | ||
|
||
STATUS_LOG="/var/log/openvpn-status.log" | ||
printf "\n" | ||
if [ ! -f "${STATUS_LOG}" ]; then | ||
echo "The file: $STATUS_LOG was not found!" | ||
exit 1 | ||
fi | ||
|
||
printf ": NOTE : The output below is NOT real-time!\n" | ||
printf ": : It may be off by a few minutes.\n" | ||
printf "\n" | ||
printf "\e[1m::: Client Status List :::\e[0m\n" | ||
printf "\t\t\t\t\t\t\tBytes\t\tBytes\t\n" | ||
printf "\e[4mName\e[0m\t\t\e[4mRemote IP\e[0m\t\t\e[4mVirtual IP\e[0m\t\e[4mReceived\e[0m\t\e[4mSent\e[0m\t\t\e[4mConnected Since\e[0m \n" | ||
if grep -q "^CLIENT_LIST" "${STATUS_LOG}"; then | ||
awk -F' ' -v s='CLIENT_LIST' '$1 == s {print $2"\t\t"$3"\t"$4"\t"$5"\t\t"$6"\t\t"$8" "$9" "$11" -- "$10}' ${STATUS_LOG} | ||
else | ||
printf "\nNo Clients Connected!\n" | ||
fi | ||
printf "\n" |
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