MailCleaner / MailCleaner-Next

Fork of MailCleaner for Debian 12
GNU General Public License v3.0
3 stars 2 forks source link

Leverage SystemD #17

Open JohnMertz opened 1 year ago

JohnMertz commented 1 year ago

Local init scripts (/usr/mailcleaner/etc/init.d/) should be a wrapper which includes necessary 'dump' steps, before calling system init script via SystemD for actual process management.

JohnMertz commented 1 year ago

52ba2d8bf89f52208e6419efbc1793ba25f0e3b8 - Introduced alternate support in get_status.pl to use 'service' instead of the commandline name, in which event it will look up the status with systemctl

JohnMertz commented 1 year ago

ccfd449d09f808dbd52c16eb13dbdc3cc530ca22 - Added a generic systemd init script which can be symlinked by any other init script to just run systemctl $0 $@

JohnMertz commented 1 year ago

1cfb8efae3aab8b642d9f08df8e81e9bc8641f74 and others - create scripts/systemd/apache.service.d/override.conf to modify built-in apache service script. Convert etc/init.d/apache to actually call etc/init.d/apache2 (for compatibility), then link the latter to systemd init script.

JohnMertz commented 1 year ago

eb86210910029abf710899557f576001c1639fef and others - convert all exim stages to use systemd. Similar to apache, the old init scripts exist for compatibility, but they each call etc/init.d/exim4@${stage} since that is the built-in name also.

JohnMertz commented 11 months ago

See ce2d987949463fc2fcb74e2796a16f82a4aa6f5a

mailcleaner.target works for start and stop, but not restart (or start too quickly after stop) because it returns from stop before mariadb is down, meaning that it tries to start again but the DB is shutting down. Need to force it to wait until these services stop. Still reading the docs for this.

JohnMertz commented 9 months ago

MariaDB no longer appears to block the restart. However, incomplete service dccifd blocks start because of permission issues and failure to open non-existent files. I need to just remove it as a blocking dependency.

JohnMertz commented 9 months ago

dccifd issue noted in another Issue. fail2ban also has an issue. Continue work in those more specific issues.

JohnMertz commented 2 months ago

Services don't completely start correctly during initial start-up. This is because various services are trying to connect to mariadb@slave too quickly. The After=mariadb@slave.service option does not seem to be sufficient, nor is setting a delay after the slave services with ExecStartPost=sleep 1, since the ExecStartPre=<dumper script> which is trying to connect does not wait on that.

Need to find a proper way of enforcing a delay. Perhaps add a dependency on the mariadb socket instead of service...