Is it possible to change the default message broadcasted by shutdown to something else?

  • 1
    What OS are you using? – jordanm Nov 27 '13 at 7:04

As @Zelda mentioned the messages are hardcoded. If you want to change it beyond amending the message with additional bits:

$ sudo shutdown -h +120 Save your work.

You'll need to recompile shutdown, creating your own executable that includes the customized message.

For example, here's a sample source file, shutdown.c. Lines such as these would need to be changed, and the .c files would need to be rebuilt.

 *      Tell everyone the system is going down in 'mins' minutes.
void warn(int mins)
        char buf[MESSAGELEN + sizeof(newstate)];
        int len;

        buf[0] = 0;
        strncat(buf, message, sizeof(buf) - 1);
        len = strlen(buf);

        if (mins == 0)
                snprintf(buf + len, sizeof(buf) - len,
                        "\rThe system is going down %s NOW!\r\n",
                snprintf(buf + len, sizeof(buf) - len,
                        "\rThe system is going DOWN %s in %d minute%s!\r\n",
                                newstate, mins, mins == 1 ? "" : "s");
        wall(buf, 0);
| improve this answer | |
  • I'm kinda surprised that it's hardcoded. I wonder if they just didn't thought about it or if it was a conscious decision with security in mind, preventing someone to do a shutdown with pointless message or no message at all. – talles Nov 27 '13 at 16:33
  • @talles - probably a little bit of both. You don't want people playing games with the messages. – slm Nov 27 '13 at 19:46

You cannot change the default message, you can only add some specific message of your by providing this after the time:

# shutdown 60 Down in an hour

Broadcast message from zelda@mongrel2_test
     (/dev/pts/0) at 6:37 ...

The system is going down for maintenance in 60 minutes!
Down in an hour

You do not have to quote the text after the number of minutes you provide shutdown. When cancelling a shutdown you can provide a message too.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.