Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Replace systemctl restart [email protected] with wg syncconf wg0 to Avoid Network Disruption #613

Open
WorkTimer opened this issue Aug 26, 2024 · 0 comments

Comments

@WorkTimer
Copy link

I propose replacing the systemctl restart [email protected] command with wg syncconf wg0 in the service execution command. This change aims to prevent network disruptions during the reconfiguration process. Here's the suggested modification:
Replace:
ExecStart=/usr/bin/systemctl restart [email protected]
With:
ExecStart=/bin/sh -c 'grep -v -e "^Address = " -e "MTU = " -e "PostUp = " -e "PreDown = " -e "PostDown = " -e "Table = " /etc/wireguard/wg0.conf | wg syncconf wg0 /dev/stdin'

/etc/systemd/system/wgui.service :

[Unit]
Description=Restart WireGuard
After=network.target

[Service]
Type=oneshot
# User=root
# Group=root
# ExecStart=/usr/bin/systemctl restart [email protected]
ExecStart=/bin/sh -c 'grep -v -e "^Address = " -e "MTU = " -e "PostUp = " -e "PreDown = " -e "PostDown = " -e "Table = " /etc/wireguard/wg0.conf | wg syncconf wg0 /dev/stdin'

[Install]
RequiredBy=wgui.path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@WorkTimer and others