The Mud Connector

Author Topic: Rom 2.4 Startup  (Read 496 times)

aTolmasoff

  • New to TMC
  • *
  • Posts: 25
    • View Profile
Rom 2.4 Startup
« on: January 07, 2017, 12:03 AM »
So I've been encountering a problem I've not had an issue with in the past.


Rom 2.4, trying to run it's startup script.

From my area directory:
nohup ./startup & 

The file is chmod'ed correctly. It also has the same script I've always used. However I get an exit code, and nothing runs. However booting it normally or with GDB works fine.  I hop in and out of the coding world, so I'm sure I've missed some update or something... just curious  if anyone knew what my issue is here.

Rhien

  • New to TMC
  • *
  • Posts: 18
    • View Profile
Re: Rom 2.4 Startup
« Reply #1 on: January 07, 2017, 10:01 AM »
It's interesting that it starts when you don't use nohup.  Do you get anything in the log files for the mud (like, did it start, and then fail somewhere or just it just not get into comm.c at all?

As a side note, I have this in my comm.c and it should remove the need for nohup (you should be able to start it normally and it will keep running when the terminal exits (it requires an include to signal.h)

Code: [Select]
   
    // This will keep the game running even when someone logs out of
    // the shell that might have started it.
    signal(SIGHUP, SIG_IGN);

aTolmasoff

  • New to TMC
  • *
  • Posts: 25
    • View Profile
Re: Rom 2.4 Startup
« Reply #2 on: January 07, 2017, 11:45 AM »
I screen captured a bit here and posted to youtube... It's strange 'cause I've never faced this issue.

Here's a link to the youtube page where you can watch the few second video.  I'm a self taught guy w/ MUDs, so I know a bit, but am pretty weak when it comes to system stuff (like these).

Hoepfully you can see what I'm doing wrong here..  It boots normally, just not w/ my script.

https://www.youtube.com/watch?v=qoJdqA4SZaI

IT's probably chmodded wrong (777 is what I did) or something stupid like that, I'm sure. :)

Tijer

  • TMC Veteran
  • *****
  • Posts: 509
    • View Profile
Re: Rom 2.4 Startup
« Reply #3 on: January 07, 2017, 12:49 PM »
is the executable in the src directory or the area directory? as the startup script is looking for it in src... but when you run gdb you are doing it from the area directory
« Last Edit: January 07, 2017, 12:56 PM by Tijer »

aTolmasoff

  • New to TMC
  • *
  • Posts: 25
    • View Profile
Re: Rom 2.4 Startup
« Reply #4 on: January 07, 2017, 1:07 PM »
So the executable is in the src dir. The startup is in the area directory.

It's Rom 2.4. I've always had to boot out of the area dir vs the src. However I did try copying my startup file into the Src directory and trying that way, with the same result. Tried copying the rom executable to area dir as well, same issue.

I've written a ticket for my server provider, make sure it's not something on their end. Used these guys for 6 years, usually no issues with them

Tijer

  • TMC Veteran
  • *****
  • Posts: 509
    • View Profile
Re: Rom 2.4 Startup
« Reply #5 on: January 07, 2017, 1:11 PM »
sent you a personal message.. check it :)

Quixadhal

  • Sr. Member
  • ****
  • Posts: 442
    • View Profile
Re: Rom 2.4 Startup
« Reply #6 on: January 07, 2017, 5:33 PM »
People seem to have a lot of trouble with startup scripts these days, probably because so many desktops are purely graphical now. *grumbles about kids on his lawn*

Anyway, just to be clear.  A startup script is optional.  You don't need it to run your game, and you can easily write your own if the supplied one doesn't work.  They only do two things.

1)  They pass a bunch of arguments to the game driver that would be a PITA to remember and type every time, and
2)  They usually have a loop to bring the game back up when it crashes, because DikuMUD style games have a long history of being very poorly coded, and crashing far more often than they should.

Here's a very simple bash script:
Code: [Select]
#!/bin/bash
while [ -x ./mud ]; do
    ./mud -options
    if [ $? = 42 ]; then
        exit
    fi
    sleep 60
done

The name of your game driver here is "mud", and it's in the current directory, which is "./".  "$?" is a magic bash variable to get the last command's exit status.  So, this script says:

while the game executable is present,
    run the game with whatever options
    if the game exits with a special status, exit the script
    otherwise, it crashed so sleep a minute and do it again

So if you coded your game driver to exit with status 42 when you did a shutdown, and some other status when you reboot or it crashes... all the script does is loop until you intentionally shut it down.

In the case of some Dikurivatives, you have to start the game in the "area" directory instead of any other, so you could add a "cd /path/to/mud/areadir" right before running the mud, and change the "./" to wherever your executable is, probably "/path/to/mud/src/".

darksix

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
Re: Rom 2.4 Startup
« Reply #7 on: February 21, 2017, 1:59 PM »
or you can add a #define for your executable in merc.h so it reads as "../src" and use this later so it can start from any sub directory by itself without switching to ../area which you also have to switch up area loading a little, but it makes it all less of a hassle if you want to start it from any sub dir. Especially if you decide you want to make a /bin directory like most programs in linux have or a /run. But everyone is right unless you code that type of feature in you will need to get your bash script to switch to ../area dir to load all that and run.  So glad I finally took the time to make it look for everything and also make sure every directory exists when launching.. saves a ton of time, also check out shutdown.txt in the area dir if it exists.
Come by Darklord! Server: darklord.evils.in Port: 9100 - Yep thats a new addy.