make wg-reload be its own thing
This commit is contained in:
parent
8805f8145b
commit
3da4d20122
@ -163,15 +163,6 @@ wg-restart() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Reload a wireguard link without stopping it
|
|
||||||
wg-reload() {
|
|
||||||
if [ $# != 1 ]; then
|
|
||||||
echo "Usage: wg-reload <interface>"
|
|
||||||
else
|
|
||||||
sudo bash -c "wg syncconf $1 <(wg-quick strip $1)"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Edit a wireguard config file
|
# Edit a wireguard config file
|
||||||
wg-edit() {
|
wg-edit() {
|
||||||
if [ $# != 1 ]; then
|
if [ $# != 1 ]; then
|
||||||
|
17
scripts/wg-reload
Normal file
17
scripts/wg-reload
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ $# != 1 ]; then
|
||||||
|
echo "Usage: wg-reload <interface>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if we have permission to run `wg`
|
||||||
|
if [ "$(id -u)" -ne 0 ]; then
|
||||||
|
# Re-launch this script as root
|
||||||
|
exec sudo "$0" "$@"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reload the WireGuard interface
|
||||||
|
wg syncconf $1 <(wg-quick strip $1)
|
Loading…
x
Reference in New Issue
Block a user