Eject CD on shutdown

view story

http://unix.stackexchange.com – OK, so I have a simple problem: I have a live CD, and I want the CD to eject when the computer is rebooted or halted. Executing /usr/bin/eject -m makes the CD eject just fine... trouble is, as you might expect, this then crashes the OS because it now can't read any files. So the reboot never happens, because /sbin/reboot is inaccessible. (I tried executing reboot --help > /dev/null right before the reboot, but there are still other files which still can't be read...) In summary, it appears that I need to make the eject be the very last thing that happens. So it seems that systemd is the p (HowTos)