How is possible to immediately stop the bootup process, show some message (quit splash screen) and shutdown machine if a oneshot service fails?
My service starts just one script. If something went wrong, or better said, if a special condition occurs, I'd like to shutdown the machine. So far, I tried to put inside the script a systemctl poweroff. But unfortunately, this call immediately returns and the bootup process is continued normally doing the shutdown more or less parallel. In my case, the login-screen appears for a few seconds until the poweroff is finally done.
Here is my unit-file:
[Unit] Description=My Fancy Script Before=NetworkManager.target [Service] Type=oneshot ExecStart=/path/to/script StandardOutput=journal+console [Install] WantedBy=basic.target I even tried to use FailureAction= but that doesn't work either.
Any ideas how to do this? There must be a "typical" way. For example, if a mountpoint could not be loaded, the system is put into maintenance mode (this ctrl-D thing ;) ) and the bootup is interrupted.