Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Administrative broadcast message #6

Merged
merged 6 commits into from
Jul 13, 2020
Merged

Conversation

wilminator
Copy link
Contributor

@wilminator wilminator commented Jul 13, 2020

Hello,
I was looking for a way to allow an administrative message to be broadcast to everyone online. I was going to use it to announce an hour out that there would be a server reboot.

I reviewed the executer.perl script as suggested, but what it appears to do, as far as I can tell, is provide restore functionality for accounts that lost items or were deleted. I also reviewed the source, and based on what I'm trying to do, editing the existing reboot functions in nice.cpp would have made the code significantly more complicated to do what I want to do.

I decided to add a new Linux signal, USR1, to trigger the read and display of the message.dat file in lib to all users. Because this can only be triggered by signal, this functionality is available to be used from outside the MUD, but only if the operator has shell access on the MUD server.

I also wrote a new script in bin, message, that takes all arguments as input, writes it to the message.dat file, then triggers the USR1 signal on vme.

Example use:
./message "The MUD is looking for donations to by the operators a beer. Please contribute!"
(This message is then sent to all online users)

Files:
bin/message - A shell script that writes it's arguments to lib/message.dat then triggers a USR1 signal to cause vme to send the contents of message.dat to all users. This file has been added to the repository.
lib/message.dat - A file whose contents are sent to all online users when the MUD program is sent a USR1 signal by the OS. This file does not need to exist for vme to run.

Thanks,
Mike

@Seifert69
Copy link
Owner

Thank you :)

@Seifert69 Seifert69 merged commit 2043ed3 into Seifert69:master Jul 13, 2020
@iamnove
Copy link
Collaborator

iamnove commented Jul 13, 2020 via email

@Seifert69
Copy link
Owner

Seifert69 commented Jul 13, 2020 via email

@wilminator
Copy link
Contributor Author

Because I'm new to the source, can you expand on what DIL is?

@iamnove
Copy link
Collaborator

iamnove commented Jul 22, 2020 via email

@wilminator
Copy link
Contributor Author

Thanks for that. This now feels like a step down from drinking from a fire hose, so I'll manage.

The process that I was working with was an automated process to stop the MUD and essentially recompile and restart. It was not my desire (per se) to schedule the mud to reboot. I'm working out of Docker and have to rely on SIGKILL or the like to stop the mud when done, otherwise I need to have my rebuild scripts wait on a cron for the mud to kill itself.

Now what I have done is introduce a mechanism that an outside program can use to invoke a command on the MUD. I can go ahead and update the command to directly invoke a DIL, but to press my luck, would it be a more useful feature to have the routine execute a specific DIL supplied by the file? Yes, I'm aware of the risks, so maybe limit it to a new zon file dedicated to being invoked externally?

@iamnove
Copy link
Collaborator

iamnove commented Jul 22, 2020 via email

@Seifert69
Copy link
Owner

Seifert69 commented Jul 22, 2020 via email

@wilminator
Copy link
Contributor Author

@iamnove That makes sense on both counts. So I'm thinking adding a DIL command that can be used to set the minimum time between responding to a signal triggered command, with the default specified in the etc/server.cfg file. I think a reasonable default is 600 seconds; this is open to discussion. I will also look expanding this to beyond messaging later; just keying on one command for now is low hanging fruit and I don't want to commit to more than I have time for.

@Seifert69 Thanks for the offer. I'm thinking for now to have the signal trigger call a new DIL that checks if it is able to trigger, and if so passes the string on as a call to wiz_broadcast. Later we can look into expanding that through the zone file to allow other calls, such as shutdown (that's actually what I need for my project), but this will at least complete the conversion of the C++ code to use a DIL.

Thanks,
Mike

@prool prool mentioned this pull request Aug 3, 2020
Seifert69 pushed a commit that referenced this pull request Aug 17, 2020
Fizzie68 added a commit that referenced this pull request Oct 11, 2020
Seifert69 pushed a commit that referenced this pull request Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants