-
Notifications
You must be signed in to change notification settings - Fork 168
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
BUG monitorix.conf overwrite #414
Comments
I'll see what can I do. |
@Saentist, please, check this patch and let me know if it works. |
@mikaku /etc/monitorix# ll
drwxr-xr-x 3 root root 4096 мар 23 13:13 ./
drwxr-xr-x 164 root root 12288 мар 23 02:59 ../
drwxr-xr-x 2 root root 4096 мар 16 16:14 conf.d/
-rw-r--r-- 1 root root 34812 мар 16 22:22 monitorix.conf
-rw-r--r-- 1 root root 28996 мар 17 00:02 monitorix.conf~ work in opposite ifneq ("$(wildcard $(PATH_TO_FILE))","")
FILE_EXISTS = 1
else
FILE_EXISTS = 0
endif https://fedingo.com/how-to-check-if-file-exists-in-shell-script/ |
its not bad to add somewhere on systemd section sudo systemctl daemon-reload
sudo systemctl enable monitorix.service
sudo systemctl reload-or-restart monitorix |
Please elaborate. |
script backup (somewhere) current config and place default config from repo in config folder again we go to this old situation #295 |
Sorry, I don't know if I understand you correctly. You mean that the new |
no file='/etc/monitorix/monitorix.conf'
if [ -f $file ]; then
#code to be run if file exists
else
#code to be run if file does not exist
fi If i read correctly in current there is no clear what is variable = |
No, the
$(DESTDIR) has no value, and since all pathname are absolute this puts this variable as a user decision if you have installed Monitorix on a different place. If you set |
So work in opposite if This is most simple logic, config is there and work, |
I can change the suffix of the backed up file with |
I agree, it means then we cannot use this functionality of |
But why you want to backup working config, and replace it with default not working one? |
Because you shouldn't use the This way your Monitorix is always up-to-date. |
Apart from that, nice thing with RPM (and DEB) packaging: %config(noreplace) %{_sysconfdir}/monitorix/monitorix.conf If the user has modified the file, the installer ( But much better if you as a user put your own changes into separate files in %config(noreplace) %{_sysconfdir}/monitorix/conf.d/00-debian.conf Whatever you place there in separate files has no risk to be overwritten. This was introduced to Monitorix some years ago for exactly this purpose. |
As @Saentist observed, the parameter Since almost no one is using the Thoughts? |
Except people with use git version with all new stuff. |
The syntax of the examples above is for a |
Good point: we package managers use that to build the packages 🤣 But as in that case the install always happens to an empty dir (for a clean package), we can ignore that 😉 And apologies if I caused confusion with the That apart, as Jordi wrote: never modify the original config, always use |
What ifneq ("$(wildcard $(PATH_TO_FILE))","")
FILE_EXISTS = 1
else
FILE_EXISTS = 0
endif there is lot of resources |
Please read first post. If problem was in packages, i'll ask why in your repo there is no "Nightly builds". |
I'll take a look, thanks for the URL. |
This commit will save as I don't know enough the Makefile syntax to provide a better solution, sorry. |
When used
make install-systemd-all
(posibly in other manual install types)monitorix.conf is overwriten, without any question.
With
dpkg -i monitorix.deb
it ask do we want to overwrite config file.Sugestion:
adding simple logic to
Makefile
IF
monitorix.conf
exist in/etc/monitorix
THEN copy to
monitorix.conf.default
ELSE just copy it ;)
No config lost.
The text was updated successfully, but these errors were encountered: