Skip to content

Instantly share code, notes, and snippets.

@newsworthy39
Last active March 24, 2024 19:40
Show Gist options
  • Save newsworthy39/5b8bcb2fcef9440df727035ad3f91b4c to your computer and use it in GitHub Desktop.
Save newsworthy39/5b8bcb2fcef9440df727035ad3f91b4c to your computer and use it in GitHub Desktop.
wq-quick systemd unit files
# This file is largely based on the tinc@ service-idea.
# Both files belong in /lib/systemd/system/
# Enable it, systemctl enable wg-quick, then enable configurations (ie, /etc/wireguard/wg0.conf)
# systemctl enable wg-quick@wg0
[Unit]
Description=Wireguard VPN
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true
WorkingDirectory=/etc/wireguard
[Install]
WantedBy=multi-user.target
# This file is largely based on the tinc@ service-idea.
# Both files belong in /lib/systemd/system/
# Enable it, systemctl enable wg-quick, then enable configurations (ie, /etc/wireguard/wg0.conf)
# systemctl enable wg-quick@wg0
[Unit]
Description=WireGuard via wg-quick(8) for %I
After=network-online.target
Wants=network-online.target
Documentation=man:wg-quick(8)
Documentation=man:wg(8)
Documentation=https://www.wireguard.com/
Documentation=https://www.wireguard.com/quickstart/
Documentation=https://git.zx2c4.com/WireGuard/about/src/tools/man/wg-quick.8
Documentation=https://git.zx2c4.com/WireGuard/about/src/tools/man/wg.8
PartOf=wg-quick.service
BindsTo=wg-quick.service
ReloadPropagatedFrom=wg-quick.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/wg-quick up %i
ExecStop=/usr/bin/wg-quick down %i
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment