add systemd services

This commit is contained in:
Roy Olav Purser 2021-09-21 14:03:45 +02:00
parent d8c78d3965
commit ef0b0c489c
Signed by: roypur
GPG Key ID: E14D26A036F21656
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,12 @@
[Unit]
Description=Wireguard Restart
After=network-online.target vpnclient-mount.service
Requires=network-online.target
Requisite=vpnclient-mount.service
[Service]
User=root
Group=root
Type=oneshot
ExecStart=/snacks/wireguard/scripts/rotate.py
NetworkNamespacePath=/run/vpn/net

View File

@ -0,0 +1,12 @@
[Unit]
Description=Reconnect to WireGuard if down
[Timer]
OnBootSec=5m
OnUnitActiveSec=1m
Persistent=False
Unit=vpnclient-wg-restart.service
[Install]
WantedBy=timers.target

View File

@ -0,0 +1,17 @@
[Unit]
Description=Wireguard
After=network-online.target vpnclient-mount.service
Requires=network-online.target
Requisite=vpnclient-mount.service
[Service]
User=root
Group=root
Type=oneshot
EnvironmentFile=/snacks/wireguard/env
ExecStart=/snacks/wireguard/scripts/connect.py
NetworkNamespacePath=/run/vpn/net
RemainAfterExit=true
[Install]
WantedBy=multi-user.target