[PATCH 1/6] wg-quick: linux: add restart command
Garrit Franke
contact at garrit.xyz
Thu May 28 20:35:49 CEST 2020
---
src/wg-quick/linux.bash | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/wg-quick/linux.bash b/src/wg-quick/linux.bash
index e4d4c4f..6f42b7f 100755
--- a/src/wg-quick/linux.bash
+++ b/src/wg-quick/linux.bash
@@ -298,7 +298,7 @@ execute_hooks() {
cmd_usage() {
cat >&2 <<-_EOF
- Usage: $PROGRAM [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
+ Usage: $PROGRAM [ up | down | restart | save | strip ] [ CONFIG_FILE | INTERFACE ]
CONFIG_FILE is a configuration file, whose filename is the interface name
followed by \`.conf'. Otherwise, INTERFACE is an interface name, with
@@ -352,6 +352,11 @@ cmd_down() {
execute_hooks "${POST_DOWN[@]}"
}
+cmd_restart() {
+ cmd_down
+ cmd_up
+}
+
cmd_save() {
[[ " $(wg show interfaces) " == *" $INTERFACE "* ]] || die "\`$INTERFACE' is not a WireGuard interface"
save_config
@@ -373,6 +378,10 @@ elif [[ $# -eq 2 && $1 == down ]]; then
auto_su
parse_options "$2"
cmd_down
+elif [[ $# -eq 2 && $1 == restart ]]; then
+ auto_su
+ parse_options "$2"
+ cmd_restart
elif [[ $# -eq 2 && $1 == save ]]; then
auto_su
parse_options "$2"
--
2.24.3 (Apple Git-128)
More information about the WireGuard
mailing list