If I do this in a script, the call to status shows "OK"
- systemctl enable foo
- systemctl start foo
- systemctl status foo
But only a few milliseconds later the status is "failed".
How can I detect if the start was successful?
What means "successful" for me here: The server started to run.
Systemd seams to start the process and does not wait to see if the server was able to start correctly.
Example: The config of the server contains a syntax error. The server will run for some milliseconds but then terminate.
The most simple solution would be to execute "sleep 1" before my call to "systemctl status foo".
But this feels dirty.
Maybe there is a better solution to get the real status after starting the server.
I only care about the starting. If the server fails two hours later, this is not part of this question.