From 0b4b48ceae38973fcedf0795c8d5a8d4133ec576 Mon Sep 17 00:00:00 2001 From: Donald Cheng Hong Zou Date: Fri, 3 Sep 2021 14:30:13 -0400 Subject: [PATCH] Update wgd.sh --- src/wgd.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/wgd.sh b/src/wgd.sh index cdb8eb44..74284b92 100755 --- a/src/wgd.sh +++ b/src/wgd.sh @@ -49,10 +49,12 @@ check_wgd_status(){ } start_wgd () { + printf "%s\n" "$dashes" printf "| Starting Wireguard Dashboard in the background. |\n" d=$(date '+%Y%m%d%H%M%S') python3 "$app_name" > log/"$d".txt 2>&1 & printf "| Log files is under log/ |\n" + printf "%s\n" "$dashes" } stop_wgd() { @@ -60,14 +62,16 @@ stop_wgd() { } start_wgd_debug() { + printf "%s\n" "$dashes" printf "| Starting Wireguard Dashboard in the foreground. |\n" python3 "$app_name" + printf "%s\n" "$dashes" } update_wgd() { new_ver=$(python3 -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/donaldzou/wireguard-dashboard/releases/latest').read(); output = json.loads(data);print(output['tag_name'])") printf "%s\n" "$dashes" - printf "Are you sure you want to update to the %s? (Y/N): " "$new_ver" + printf "| Are you sure you want to update to the %s? (Y/N): " "$new_ver" read up if [ "$up" = "Y" ]; then printf "| Shutting down Wireguard Dashboard... |\n" @@ -81,7 +85,7 @@ update_wgd() { start_wgd else printf "%s\n" "$dashes" - printf "CANCEL update. \n" + printf "| Update Canceled. |\n" printf "%s\n" "$dashes" fi } @@ -93,16 +97,22 @@ if [ "$#" != 1 ]; else if [ "$1" = "start" ]; then if check_wgd_status; then + printf "%s\n" "$dashes" printf "| Wireguard Dashboard is already running. |\n" + printf "%s\n" "$dashes" else start_wgd fi elif [ "$1" = "stop" ]; then if check_wgd_status; then + printf "%s\n" "$dashes" stop_wgd printf "| Wireguard Dashboard is stopped. |\n" + printf "%s\n" "$dashes" else + printf "%s\n" "$dashes" printf "| Wireguard Dashboard is not running. |\n" + printf "%s\n" "$dashes" fi elif [ "$1" = "update" ]; then update_wgd