2 deleted 24 characters in body; edited tags
source | link

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 occoursoccurs, 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.

Thanks for your help!

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 occours, 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.

Thanks for your help!

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.

1
source | link

systemd: stop boot process on failure (actually make a shutdown)

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 occours, 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.

Thanks for your help!