Hi MichaIng yes I see all that (and by system I am meaning anything controlled by systemd services), but it can only ever be a partial solution and it may actually cause more problems than it solves, especially if it is opaque to the user (as it was to me and I’ve used DietPi for years and think it is great).
For instance, I self install EmonCMS (the full system not your package) and as well as a LAMP stack, it also needs Redis. For various reasons it does not use Redis from APT but PECL. This means Redis is installed outside of dietpi-services scope and there is no way DietPi can possibly know the dependency order. Equally EmonCMS uses Mosquitto which again you cannot know the dependency or the start order. Actually, EmonCMS is pretty robust and it sorts itself out quite happily.
So whilst I do agree with what you do to some extent, and for certain packages it may be vital, I think this should be more transparent so users are aware of what is actually happening and, where the user so desires, the services are left to systemd to manage as per the defined service files.
We simply “disable” it, which means that systemd does not autostart them on boot
Does this mean you actually use
systemctl disable service
If so that can have unexpected consequences (as I outlined elsewhere). Do you then run a
systemctl enable service
then a
systemctl start service
Looking at the code it seems you do.
I think the real concern here is how this is communicated to users. I was unaware of this process (and that probably explains some issues I had in the past) and also unaware of the ability to exclude services from DietPi control (.dietpi-services_include_exclude).
Might I suggest that, when a package that includes a service is installed, you ask the user if they wish the service to be controlled by DietPi? Alternatively an overall check after install? As a minimum, is it possible to exclude services from some sort of config tool (other than just CLI or editing a file)?
On installing and running Monit as a service,
What you mean by “delay” it starting?
In this particular case, if left to systemd to start the service file, the web interface for Monit never started properly. I tried all manner of wants, requires, after etc all to no avail. The only solution was to introduce a timer file that systemd starts so the service is delayed for 30s before being started - then it was all OK.
This has been a really useful insight as to how this all works ‘under the hood’. Thanks.
My final observation is that this does expose what I have always felt is the greatest weakness of DietPi, the documentation. So much of this useful info is buried in this forum. However, please keep up the great work you do.