Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   system calls (http://www.topmudsites.com/forums/showthread.php?t=300)

Emit 06-27-2002 11:47 PM

we've been having some problems with crashes at the mud i code for.  sometimes it will crash and the parent process dies too (a startup script running on a loop).  when this happens the mud is down for hours at a time, since only two people can get to the server.  we have a copy of the game running on another port, completely independant of the main one, and its up all the time.
until we get all these bugs under control, i was thinking of writing a command for the test port that would run the startup script for the main port (so staff members can start the main game up with out going to the server), but i don't know of a way to do this.
any suggestions?

thelenian 06-28-2002 01:15 AM

Codebase? Dev platform? Host OS?

Emit 06-30-2002 02:19 PM

its a rom mud on a server running redhat 7.2

LordKiev 07-19-2002 10:50 PM

Um... Trying to think. Basically, just write a command (startmain) or something, and have it execute a system call. The sytanx would be system("command"); so, depending, somthing like:

[code]
void do_startmain(char *argument, CHAR_DATA *ch)
{
if(!IS_IMMORTAL(ch))
return;
system("./../area/startup 3345")
return;
}
[/quote]
This hasn't been bug-tested, but that's the general assumption, assuming you're running them off the exact same code. If you're not, and especially if they're run off different accounts, then that's more about Linux than I know. But essentially make the system call to wherever the startup script is. But I'm curious, are the two sets of code the same? Same account, same privledges, etc?

Robbert 07-20-2002 09:34 PM

I strongly recommend doing more than just a system call. At the very least, check against the game running already, and if it is abort the command. You could do even better by adding this to the startup script. Take it one step further and add a panic-exit to the script if logfile > 1000 increments. A very large number of admins out there will end up starting 2 or more processes of the startup script, and then kill them hours or days later (or the sysadmins will), but there are > 10000 logfiles created by that time, which must be iterated through in the startup process.... bah

Check for the game running, and save yourself and others some heartache later.

thelenian 07-21-2002 08:44 AM

The simplist approach I can think of would bypass system calls completely. Just do message passing through a file. It's sort of a kludge, but it gets the job done.

All you need is a perl script running in the background that continually checks for the existance of a certain file. If the file exists, the script executes whatever checks are necessary to ensure that it's a valid boot attempt, calls the boot script., and then deletes the file.

The command to reboot the MUD from the test port would simply create the file that the script checks for.

This will work even if your test MUD is on a different account, as long as the script is running with the proper permissions.

edit:

Regarding security, this solution is very good. The test mirror account doesn't need to have write,exec, or even read permission on the live account.


All times are GMT -4. The time now is 10:01 PM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022