How can I show a custom message before shutting down Linux?

0
4
Asked By MellowCactus47 On

I'm using PikaOS, which is Debian-based, and I'd like to display a simple message such as "turn 'em off" immediately before the computer shuts down. I'm not particular about whether it appears in a terminal, as a notification, or in another convenient format.

3 Answers

Answered By OrbitPiano8 On

You can broadcast a message to logged-in users with `wall "Turn 'em off"`, then run the shutdown command afterward. For example: `wall "Turn 'em off"; sleep 2; shutdown -h now`. This should work on most Debian-based systems.

MellowCactus47 -

That’s exactly the kind of simple message I was looking for. The format doesn’t matter much as long as it appears before shutdown.

Answered By QuietMaple6 On

The `shutdown` command can already display a warning to logged-in users when a delay is specified. Check `man shutdown` for the options supported by your system, then combine that with a custom `wall` message if you want your own wording.

Answered By CopperBreeze21 On

If you want a full-screen visual instead of terminal text, you could invoke a screen locker first, wait briefly, and then shut down. A shell alias could look like `lock; sleep 2; shutdown -h now`, assuming your desktop has a suitable locking command.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.