Re: Circle as a service

From: Patrick Dughi (
Date: 01/17/02

> I'm looking for information here on how I can make Circle into a service
> for my linux box...  Similar to like httpd, dhpcd, etc. - something that
> linuxconf will recognize, that will start on boot, the whole 9 yards.
> Is there anyone who is aware of somewhere I can look to find more
> information on how to do this?  Also, is there any potential
> conflicts/problems that I'm not aware of?  Thanks,

        This is not immediately possible, as circlemud is not meant to be
run as a daemon process (not a service, that's windows).

        To run via the init scripts, it needs to return instantly (ie,
detach from it's controlling terminal).  Not only does circle NOT do
this, it also depends (for normal logging, and day to day functioning) on
an autorun script.  This EXPLICITLY requires that circle not detatch, else
it can't complete it's primary function (to run circle when circle is done

        It too, itself, does not detatch, though you can nohup it and run
in the background (which is about the same thing).

        However, the scripts are not exactly meant to be run like that.

        All the same, you also need a way to shutdown circle AND the
autorun script, and not in that order.  The standard method is sending a
kill signal to their pid's.  The bigest problem here is just trial and
error; the functions contained in the bash scripts are incredibly
simplistic, and rely on you having the exact arguments as they'd appear in
a 'ps' list.

        If you're capable of doing all that, you should be in pretty good

to start, do something like ...

echo -n "Starting Circlemud:"
daemon nohup /path/to/autorun &
touch /var/locl/subsys/circle

to stop, do something like ..
echo -n "Stopping Autorun:"
killproc /path/to/autorun
echo -n "Stopping CircleMUD:"
killproc bin/circle <command line arguments as they appear>
rm -f /var/lock/sybsys/circle

I'd add a 'exit 1' at the end of the script ...
        As for the case<=>esac, i'll leave that as an exercise.

        Remember, this may not work if you don't have the killproc lines
exactly as it shows up in ps.  It may not work altogether, actually, since
it really should not rely on nohup & backgrounding.

        You'll have to test and see.

        In anycase, once you have those, it's a simple trick to get them
to run automagically .. go to the rc5.d directory (that's your standard
runlevel) and do a soft link from there to your executable.  The link
names are in code;


k= kill (ie, sends the argument of 'stop' to your script)
s = start (sends argument of 'start' to your script)
# = priority, higher means run later.

so, K50circle   would run the script 'circle' with the args 'stop' pretty
late in the kill list (should make circle die early, it's not vital).

S50circle would run the script with the'start' argument far too early
though - in my sample system, the inet stuff gets set up at 50... so run
it later like around 90.

        Of course, it will depend on your setup, so put it after the
network stuff, and you should be okay.

        Still, I don't recommend it... *sshrugs*


(oh - a note, running your program through that disables the creation of
core files, it's not meant for programs needing debugging)

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT