-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
В Fri, 27 Feb 2015 23:00:19 +0100
Johannes Kastl
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Dear all,
second systemd question:
I need to change the boot process on one of my machines. I added a backup job, that takes a while. To avoid errors, I'd like to get the system to wait until the script is finished, before showing login prompts or the display manager.
The script itself looks something like this: - ----------------
[Unit] Description="some description" ConditionFileIsExecutable=/path/to/script.sh After=basic.target
[Service] Type=oneshot ExecStart=/path/to/script.sh TimeoutSec=0 RemainAfterExit=yes
[Install] WantedBy=getty.target
I rtfm'ed that I have to add a Requires:-line to one of the later units, to get that unit to really wait for the script (or rather override the definition of that unit, but that is the first question in a separate mail... ;-) ).
No, you are wrong. Requires does not affect ordering of units (OK, there are some implicit dependencies for target units, but let's this is exception). Ordering of units is specified using Before or After parameters. They are symmetrical - having "After: B" in unit A definition is the same as having "Before: A" in B definition. So you just need to add "Before: some-correct-unit" to your backup service.
Which units would I have to change to get the login prompts and the display manager to wait? I tried some, including display-manager.service, but still I get an X-Server very early. The login prompts are appearing long after the X-server started, but the script might still be running (shown in process list).
If you added "Requires" this is expected :) Try simply adding Before: display-manager.service to your unit. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEUEARECAAYFAlTxYtoACgkQR6LMutpd94zWzgCXQFBHtZ69sRpTev58PTBp4Nji IwCfVO9L/sXEvRk5Xz4UgACf3faWbAs= =jddi -----END PGP SIGNATURE----- N�����r��y隊Z)z{.���r�+�맲��r��z�^�ˬz��N�(�֜��^� ޭ隊Z)z{.���r�+��0�����Ǩ�