Ich hatte das glaube schon mal raus gefunden aber vergessen zu kommunizieren. Daher aus aktuellem Anlass.
Wenn man FHEM mit einer Konfig ohne fakelog und Eintrag von attr global logfile - im global Device mittels systemd und dem Eintrag Type=forking im Systemd Skript startet wird alle 1,5 Minuten das FHEM neugestartet.
Grund ist das die Ausgabe des Logs dann auf der Konsole passiert, im Falle von systemd also in systemd. Dadurch kommt der Startprozess aus systemd Seite nicht zu einem Abschluss und es greift der watchdog von systemd.
Grüße
Heisst das, dass von systemd per type=forking gestartete Prozesse keine Ausgabe produzieren duerfen?
Wo/wie kann man diesen systemd log anschauen?
Ich habe es nur durch eine kleine Testserie herausgefunden.
Dazu habe ich einmal
cd /opt/fhem/
su -c '/usr/bin/perl fhem.pl fhem.cfg.demo' fhem
aufgerufen und festgestellt das auf der Konsole ein Log ausgegeben wird und nicht auf hört. Ich bekam also kein Promt zurück.
Danach habe ich
cd /opt/fhem/
su -c '/usr/bin/perl fhem.pl fhem.cfg' fhem
aufgerufen und da kam kein Log sondern sofort der Prompt zurück.
Ich gehe davon aus das genau das selbe beim Aufruf durch den systemd passiert und dadurch kein exit 0 dafür sorgt das dem systemd gesagt wird das der Prozessaufruf erfolgreich war.
Zitatfestgestellt das auf der Konsole ein Log ausgegeben wird und nicht auf hört
Das liegt aber nur indirekt am Fakelog: wenn "att global logfile -" ist, dann wird nicht geforkt, und die Ausgabe auf stdout geschrieben (meine Lieblingsmethode beim testen). In diesem Fall macht ein Fakelog auch kein Sinn, da man im stdout nicht herumsuchen kann.
Die Ursache ist also weder Fakelog, noch stdout, sondern dass der Prozess nach einer gewissen Zeit nicht terminiert (d.h. nicht forkt).
Zitatreset-failed [PATTERN...]
Reset the "failed" state of the specified units, or if no unit name is passed, reset the state of all units. When a unit fails in some way (i.e. process exiting with non-zero error code, terminating abnormally or timing out), it will automatically enter the "failed" state and its exit code and status is recorded for introspection by the administrator until the service is stopped/re-started or reset with this command.
In addition to resetting the "failed" state of a unit it also resets various other per-unit properties: the start rate limit counter of all unit types is reset to zero, as is the restart counter of service units. Thus, if a unit's start limit (as configured with StartLimitIntervalSec=/StartLimitBurst=) is hit and the unit refuses to be started again, use this command to make it startable again.
Das habe ich gefunden.
Ich denke das die Beobachtung dadurch kommt das die Ausgabe des fhem Prozesses beim systemctl Aufruf auf stdout passiert und nicht in ein Logfile.
Eventuell müsste man das systemd Skript an passen und da die Ausgabe umlenken.
Habe noch das dazu gefunden
ZitatNonBlocking=
Set the O_NONBLOCK flag for all file descriptors passed via socket-based activation. If true, all file descriptors >= 3 (i.e. all except stdin, stdout, stderr), excluding those passed in via the file descriptor storage logic (see FileDescriptorStoreMax= for details), will have the O_NONBLOCK flag set and hence are in non-blocking mode. This option is only useful in conjunction with a socket unit, as described in systemd.socket(5) and has no effect on file descriptors which were previously saved in the file-descriptor store for example. Defaults to false.
Leider ist mein englisch hochgradig bescheiden schön. Aber könnte das ein Hinweis auf meine Beobachtung sein?
https://github.com/systemd/systemd/issues/7748