Qube startup/shutdown lifecycle Hook, blocking alternative to rc.local?

Hello community,

I am trying to implement a startup and shutdown script in a blocking manner, before applications inside a qube get started.

Or in other words:
Trigger a qube application via start menu → Startup script (blocking) → Application start → Shutdown script

There are two issues with existing /rw/config/rc.local:

  • The script is not blocking, race conditions may arise - especially, if script takes longer
  • There is no shutdown equivalent

As workaround I modified the application .desktop file. But it’s harder to maintain and doesn’t account for qube startup as a whole - you will need to start the specific application or modify all apps for trigger.

Systemd is a good-enough tool for boot startup and shutdown routines. I managed to do the shutdown:

...
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStop=/my/shutdown/script
...

But is there also an equivalent way for startup? Tried:

[Unit]
Requires=multi-user.target
Before=multi-user.target

[Service]
Type=oneshot
ExecStart=/my/startup/script

[Install]
WantedBy=multi-user.target

oneshot should block, if I read correctly. Before to execute script before multi-user.target.

Unfortunately, it’s still not blocking (as well with graphical.target).

Any idea?

Best greetings