LPMuds.net
September 03, 2010, 11:30:49 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: This is the forum page. For the main LPMuds page, visit http://lpmuds.net
 
   Home   SITE FAQ INTERMUD DOWNLOADS LINKS Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Restart Mud after shutdown  (Read 893 times)
Dorrin
Acquaintance
*
Offline Offline

Posts: 4


View Profile
« on: October 20, 2009, 10:16:04 PM »

Hey all,

I'm in the process of setting up my new game and I was in the process of working on the shutdown routine when I realized, I've never set up anything to restart a mud after it's gone down.

I did a little bit of googling and found some perl scripts that run off of cron, and some vague hints about rc.local, but does anyone have any hints to point me towards for this?

Thanks!
Logged
gorgar
Acquaintance
*
Offline Offline

Posts: 8


View Profile
« Reply #1 on: October 21, 2009, 01:46:33 AM »

This is how I do it.. at least. There are many ways. This way retries every 1 minute.

cron entry:
* * * * * /home/yourmud/bin/mud_start_cron_job  > /dev/null 2>&1


contents of mud_start_cron_job:
#!/bin/bash

if [ "$(/sbin/pidof ldmud)" = "" ]; then
/home/yourmud/bin/script_to_start_your_mud
fi

you will need to replace 'ldmud' with the name of your mud executable if you aren't using ldmud.  You should be using it but that's another debate. Smiley


inside your script_to_start_your_mud i like to do things like delete old log files or rotate them with dates, crap like that.
Logged
dmgambone
Acquaintance
*
Offline Offline

Posts: 3


View Profile WWW
« Reply #2 on: October 21, 2009, 09:06:23 PM »

FluffOS generally comes with a startmud script in the bin/ directory that looks like this:
#!/bin/sh

# Specify your mud dir here.
MUDHOME="<YOUR MUD PATH HERE>"

# It has been reported that non-US users have problems
# with some .o files because their systems default to
# commas for decimal notation and not periods. The
# following language exports are for the benefit of
# people who run into this problem.

LANG=en_US
LANGUAGE=en_US
LC_ALL=en_US
export LANG LANGUAGE LC_ALL MUDHOME

umask 007

ulimit -n 1024

while [ true ]; do

    if [ $MUDHOME ] && [ -f $MUDHOME/bin/driver ]  && [ -f $MUDHOME/bin/mudos.cfg ]
        then
        $MUDHOME/bin/driver $MUDHOME/bin/mudos.cfg
        else
        if [ -f ./driver ]  && [ -f ./mudos.cfg ]
            then
            ./driver ./mudos.cfg
            else
            break
        fi
    fi

done


I then have a cron job set to:
@reboot cd <PATH TO MUD bin/ DIRECTORY>; ./startmud > /dev/null 2>&1 &
Remember, whatever account you want the MUD to run under, make sure you log into that account and enter the line above using crontab -e command.  This will start up the MUD on server reboots and the startmud script will keep them running between MUD reboots.



Logged

Also known as Krem on Nightmare/Rise of Praxis MUDs and on the AJAXMud Forums
Dorrin
Acquaintance
*
Offline Offline

Posts: 4


View Profile
« Reply #3 on: October 25, 2009, 03:38:02 AM »

Awesome, it's working now. Thanks!
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!