Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
nothing serious, I've just been wondering if I could possibly change the "Bradcast message from root (tty1) ..." - I grep-ed it out of /sbin/shutdown, but since that's a binary file, I won't meddle with it.
Any hints?
if there's a choice to make, I'd go with "Braodcast message from God (tty0): the Universe is going down for shutdown NOW!"
well, seriously, the trouble with that would be that I'd have t remove two %s-placeholders (the username and tty-indicator) from the message in the binary code - which would lead to programming errors. So... would I have to re-compile it?
Yes, you would have to recompile it. Which is not a serious challenge considering what you want to do. I'll go see if I can find the shutdown source for slackware myself and if I can give you some pointers.
In the meantime, have you tried adding a message to the command?
shutdown -h now "All you guys are going to pay!"
Or something like that... it might meet your needs, although I am not certain it wouldn't print both.
Oh, it looks like you are going to have to change the default behavior of wall... which would be a bad thing. But that is the program that is adding the information you want to change (root->God). You can create an account named God, su into that, and then run shutdown and it might change the name.
For your other change, edit shutdown.c (it is in the sysvinit-2.84.tar.gz file).
Code:
/*
* Tell everyone the system is going down in 'mins' minutes.
*/
void warn(mins)
int mins;
{
char buf[MESSAGELEN + sizeof(newstate)];
int len;
strncpy(buf, message, sizeof(buf));
buf[sizeof(buf) - 1] = 0;
len = strlen(buf);
if (mins == 0)
snprintf(buf + len, sizeof(buf) - len,
"\rThe system is going down %s NOW!\r\n",
newstate);
else
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, 1, 0);
}
You need to change system to Universe in both places where it occures. There are other messages where it still says system and you might want to change them also to it reflects the word universe. Rebuild the program, install it with the correct permissions and you are all set.
EDIT: The other program you would change would be dowall.c -- you could do it the easy way, and break its functionality by hardcoding strings, or you could perform a test and if you are root change the string to God. I leave that up as an exercise to you.
Hint: user = pwd ? pwd->pw_name : (uid == 0 ? "root" : uidbuf);
Look for that line. And, YOU MUST REBUILD ALL PROGRAMS THAT DEPEND ON THIS IF YOU CHANGE IT. Just rebuild everything in the directory to be safe.
Thanks for your hints! In the end, I settled with echo-ing a Latin bible quote right before powerdown, so I won't have to recompile everything - but I might just take a look at that shutdown code to play around a little - nothing wild tho
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.