I am developing a battery backed up cape for a Beaglebone project which uses systemd under Angstrom. In order to conserve battery life, I would like to signal my battery control hardware via a GPIO when system shutdown is complete and all file systems have been dismounted. Is there a "hook" in systemd which will allow me to call a small user helper program at this point. Looking at the shutdown.c source, I see the following code:

        if (access("/run/initramfs/shutdown", X_OK) == 0) {

                if (prepare_new_root() >= 0 &&
                    pivot_to_new_root() >= 0) {
                        execv("/shutdown", argv);
                        log_error("Failed to execute shutdown binary: %m");
                }
        }

Is the intention of this code to provide such a hook? Can I cheat by creating /run/initramfs/ just prior to shutdown and copy a small shutdown executable of my own here. This sounds like it may work, but seems like a terrible hack. I feel that there should be a more elegant way to achieve this goal.

Thanks for any advice.

Dave.


_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to