aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2018-06-01 15:38:58 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2018-06-01 15:38:58 +0200
commit95ef45d51a072f058a27e511d53205687977ab53 (patch)
tree07d1800287bae423942168a374c5bf865dd63e13 /bin
parentdb28e7b8f435b3a2ea6b1688a869b61d3c71d9a8 (diff)
downloaddotfiles-95ef45d51a072f058a27e511d53205687977ab53.tar.gz
dotfiles-95ef45d51a072f058a27e511d53205687977ab53.zip
bin: added the logs command to vpnsetup
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/vpnsetup19
1 files changed, 12 insertions, 7 deletions
diff --git a/bin/vpnsetup b/bin/vpnsetup
index 0316688..5b3df44 100755
--- a/bin/vpnsetup
+++ b/bin/vpnsetup
@@ -22,8 +22,9 @@ __vpnsetup_help() {
echo -e "vpnsetup [command] [endpoint]\n\nThe vpnsetup commands are:\n"
tab=$'\t'
column -t -s $'\t' <<HERE
- start${tab}Start the VPN service.
+ log${tab}Show the logs for the VPN service.
restart${tab}Restart the VPN service. The default if no command was passed.
+ start${tab}Start the VPN service.
stop${tab}Stop the VPN service.
HERE
@@ -59,11 +60,21 @@ if [ "$1" != "" ]; then
cmd="$1"
fi
+# Check the endpoint to use.
+endpoint="SUSE-NUE"
+if [ "$2" != "" ]; then
+ endpoint="$2"
+fi
+
case "$cmd" in
-h | --help)
__vpnsetup_help
exit 0
;;
+ log | logs)
+ sudo journalctl -u "openvpn@$endpoint.service"
+ exit 0
+ ;;
start | restart)
sudo cp /etc/resolv.conf.vpn /etc/resolv.conf
;;
@@ -77,10 +88,4 @@ case "$cmd" in
;;
esac
-# Check the endpoint to use.
-endpoint="SUSE-NUE"
-if [ "$2" != "" ]; then
- endpoint="$2"
-fi
-
sudo systemctl $cmd "openvpn@$endpoint.service"