OPNsense Forum

Archive => 24.1, 24.4 Legacy Series => Topic started by: sdetroch on June 21, 2024, 02:15:23 PM

Title: VNSTAT: configfile overwritten after reboot [SOLVED]
Post by: sdetroch on June 21, 2024, 02:15:23 PM
Hello,

the vnstat configfile located in /usr/local/etc/vnstat.conf is overwritten after every reboot (or restart of the service). Since the plugin in OpnSense is not using our default date notation (YY-MM-DD and not DD-MM-YY) etc ... I have modified the config file, but how can I keep the modified config after reboot? Changing the .sample file as well didn't help.

If not possible, maybe make the parameters available in the OpnSense GUI?
Title: Re: VNSTAT: configfile overwritten after reboot
Post by: sdetroch on June 21, 2024, 05:15:24 PM
Will try to solve it by copying the saved config over the default config after boot (not tested yet), created the following file. I will not expect issues?

/usr/local/etc/rc.syshook.d/start/93-vnstat


#!/bin/sh

echo -n "Restoring vnstat config"
cp /usr/local/etc/vnstat.conf.restore /usr/local/etc/vnstat.conf
Title: Re: VNSTAT: configfile overwritten after reboot
Post by: Monviech (Cedrik) on June 21, 2024, 06:05:44 PM
You could change the template.

https://github.com/opnsense/plugins/blob/master/net/vnstat/src/opnsense/service/templates/OPNsense/Vnstat/vnstat.conf
Title: Re: VNSTAT: configfile overwritten after reboot
Post by: sdetroch on June 21, 2024, 07:02:40 PM
Thanks a lot, that's indeed easier.
Wasn't aware of this template.