I'm writing a cloud sync script for Ubuntu 18+ that makes sure some critical files are pulled from the remote as part of the boot process. I'd like it to run after the Plymouth splash screen, but before the user login screen (either with or without a graphical environment).
Delaying login until the script has exited is imperative for this application, because I need to print a message to the console and wait for the user to press a key to acknowledge before they can log in; but I can't seem to get the systemd service unit right.
The example below works for non-graphical environments (systemd default.target = multi-user.target) but not for graphical ones (default.target = graphical.target). What am I missing?
[Unit] Requires=network-online.target After=network-online.target plymouth-quit-wait.service Beforefirstname.lastname@example.org [Service] Type=oneshot StandardInput=tty StandardOutput=tty StandardError=tty TTYPath=/dev/tty1 ExecStart=/home/user/myscript.sh [Install] WantedBy=multi-user.target
RequiredBy=in addition to