added instructions for openrc inotifyd config watching on alpine to README.md (#27)

This commit is contained in:
Jaryl Chng 2020-09-14 03:39:18 +08:00 committed by GitHub
parent eff5757cba
commit d82da2fb35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 29 additions and 0 deletions

View File

@ -33,6 +33,8 @@ Download the binary file from the release and run it with command:
## Auto restart WireGuard daemon
WireGuard-UI only takes care of configuration generation. You can use systemd to watch for the changes and restart the service. Following is an example:
### systemd
Create /etc/systemd/system/wgui.service
```
@ -59,11 +61,38 @@ WantedBy=multi-user.target
```
Apply it
```
systemctl enable wgui.{path,service}
systemctl start wgui.{path,service}
```
### openrc
Create and `chmod +x` /usr/local/bin/wgui
```
#!/bin/sh
wg-quick down wg0
wg-quick up wg0
```
Create and `chmod +x` /etc/init.d/wgui
```
#!/sbin/openrc-run
command=/sbin/inotifyd
command_args="/usr/local/bin/wgui /etc/wireguard/wg0.conf:w"
pidfile=/run/${RC_SVCNAME}.pid
command_background=yes
```
Apply it
```
rc-service wgui start
rc-update add wgui default
```
## Build
### Build docker image