wg-installer: install cronjob
Install a cronjob that removes unused wireguard interfaces every 10 minutes. Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
parent
da48bc3792
commit
432a965689
2 changed files with 15 additions and 0 deletions
|
@ -39,6 +39,9 @@ define Package/wg-installer-server/install
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
$(INSTALL_CONF) ./wg-server/config/wgserver.conf $(1)/etc/config/wgserver
|
$(INSTALL_CONF) ./wg-server/config/wgserver.conf $(1)/etc/config/wgserver
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./wg-server/config/wgserver.init $(1)/etc/init.d/wgserver
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/wg-installer-server/conffiles
|
define Package/wg-installer-server/conffiles
|
||||||
|
|
12
net/wg-installer/wg-server/config/wgserver.init
Normal file
12
net/wg-installer/wg-server/config/wgserver.init
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=99
|
||||||
|
|
||||||
|
# install cleanup script that executes every 10 min
|
||||||
|
boot() {
|
||||||
|
test -f /etc/crontabs/root || touch /etc/crontabs/root
|
||||||
|
grep -q '/usr/share/wginstaller/wg.sh cleanup_wginterfaces' /etc/crontabs/root || {
|
||||||
|
echo "*/10 * * * * /usr/share/wginstaller/wg.sh cleanup_wginterfaces" >> /etc/crontabs/root
|
||||||
|
}
|
||||||
|
/etc/init.d/cron restart
|
||||||
|
}
|
Loading…
Reference in a new issue