synology-wireguard/scripts/start

19 lines
364 B
Plaintext
Raw Normal View History

2021-01-21 07:45:49 +07:00
#!/bin/sh
2021-02-07 01:51:59 +07:00
if [ "$EUID" -ne 0 ]; then
2021-01-21 07:45:49 +07:00
echo "This script must be run as root"
exit 1
fi
dir=`dirname $0`
sed -i 's/package/root/' "$dir/../conf/privilege"
synopkg start WireGuard > /dev/null
2021-02-07 01:51:59 +07:00
if [ "$?" -eq 0 ]; then
2021-01-21 07:45:49 +07:00
echo "WireGuard has been successfully started"
exit 0
else
echo "An error occurred during WireGuard startup" 1>&2
exit 1
fi