add Wireguard systemd service configuration

This commit is contained in:
Bruno BELANYI 2020-05-04 18:32:10 +02:00
parent fea4d78d1e
commit 262381c930
3 changed files with 26 additions and 0 deletions

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
all: wg
wg: /etc/systemd/system/wg-gen.service /etc/systemd/system/wg-gen.path
systemctl enable wg-gen.{path,service}
systemctl start wg-gen.{path,service}
/etc/systemd/system/wg-gen.%: wg/wg-gen.%
cp $< $@

8
wg/wg-gen.path Normal file
View file

@ -0,0 +1,8 @@
[Unit]
Description=Watch /etc/wireguard for changes
[Path]
PathModified=/etc/wireguard
[Install]
WantedBy=multi-user.target

10
wg/wg-gen.service Normal file
View file

@ -0,0 +1,10 @@
[Unit]
Description=Restart WireGuard
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart wg-quick@wg0.service
[Install]
WantedBy=multi-user.target