I am using a bash script with the shutdown command to halt my system. I know that shutdown can print a message as an argument. Here's my current command:

shutdown -h now "Shutdown complete. You may now unplug the power."

However, this prints my message before the shutdown command does its thing, and so I see a ton of other messages afterwards, such as "INIT: Sending processes the TERM signal" and "Unmounting local filesystems..."

I want to print a final message at the end of the halt, so that the user knows when it is safe to unplug the power. How can I do this?

(I am on an embedded system running Petalinux 2019.1.)

  • If the system is halted, how can the computer possibly communicate to the user? Jan 12, 2021 at 23:06
  • I don't need the message to be printed after everything halts, just after all the other shutdown steps are completed. Instead of command->message->prep->halt, I want command->prep->message->halt Jan 12, 2021 at 23:14
  • Where do you expect to see the message? Jan 12, 2021 at 23:30

1 Answer 1


This is a semi-educated guess:

This would be saved to /etc/rc0.d/K01zzz_goodbye_message

echo "Shutdown will complete soon. Unplug me."
  • I do see a S90halt script there, I could edit it, or make the new one as you suggest. I'll try these out tomorrow and see what works Jan 13, 2021 at 1:58
  • The S scripts and the K scripts run at different times ("start" and "kill" if I recall, I only play a sysadmin online), so do some research. Jan 13, 2021 at 2:58
  • Yeah they're run in alphabetical order. Putting that goodbye_message script just before halt (S89) still had it before a lot of the other shutdown messages. I think the correct course is to add the echo at the end of the halt script itself Jan 13, 2021 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .