Best way to execute a command after Linux system halt

Posted by Lukas Loesche on Server Fault See other posts from Server Fault or by Lukas Loesche
Published on 2012-10-10T15:05:38Z Indexed on 2012/10/10 15:39 UTC
Read the original article Hit count: 311

Problem: The SSDs in our servers require a power cycle (i.e. off/on, not reset/warm reboot) after a firmware update.

Thoughts: Using 'ipmitool chassis power cycle' I can cycle the server's power. However this would cut the power while the system is still running, filesystems are mounted, etc.

What I basically want is a delayed power cycle so the system has a change to halt. But I guess that would have to be implemented on the server's IPMI board, so it's not really an option.

My initial idea was to dynamically create a ramdisk containing the tool and libs and somehow integrate that into the halt process. I saw there's a /etc/init.d/halt, so that would be my starting point. Although I believe the kernel at some point in the shutdown process starts to kill off remaining processes. So I'm not even sure if that's a viable way.

Question: What would be the best way to execute ipmitool (or any other command), after the system has halted and all regular filesystems are unmounted?

© Server Fault or respective owner

Related posts about linux

Related posts about dell-poweredge