[systemd-devel] [script] Eject CD before shutdown

Lennart Poettering lennart at poettering.net
Fri Sep 14 10:20:04 PDT 2012


On Fri, 14.09.12 00:14, Philip Müller (philm at manjaro.org) wrote:

> So, seems to work. I attached my current scripts and two picutes
> with error messages.
> Also I added now *read -t 30* and fixed hanging by pressing the
> Enter-key. Is there any way
> to hide those error messages (seems the system still tries to read
> from CD after it got ejected),
> so my message gets displayed clean? Maybe there is a way to get it cleaner.

You are ejecting the root disk? Well, that's difficult to get right.

You could transition back into an initrd of some kind and print the
message there:

http://www.freedesktop.org/wiki/Software/systemd/InitrdInterface

Or you could print this message from a script in
/usr/lib/systemd/system-shutdown and hope for the best. (And turn off
console printk output via /proc/sys/kernel/printk first). Since the
systemd-shutdown binary (which runs at the very end) locks itself into
memory you might be able to get away with that. That said, the initrd
thing is the only fix that would really get this right.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list