25 Jul, 2015, Karmon wrote in the 1st comment:
Votes: 0
Hey friends
we are starting a very modified mud
just that we have a promlem with the startup.
the mud is Rom Codebase
but a lot of changes - the startup file in src is not rom - another file

anyway the normal startup not working (even when i change the rom to the new name)
I've found another startup file - its working
BUT - When I reboot its not auto restart the mud
which means reboot = shutdown

anyone knows how to fix it?
or how to write a new startup file?
please
thanks
25 Jul, 2015, quixadhal wrote in the 2nd comment:
Votes: 0
You'll need to modify how it launches the MUD to match your setup, and this is for Debian systems, so YMMV if you're using something else. Learn bash scripting. Enjoy!

PS: Pardon the poor indentation. That's the forum guessing wrong and fiddling with stuff.

#!/bin/sh
#
### BEGIN INIT INFO
# Provides: wiley
# Required-Start: $network $local_fs $remote_fs $syslog $named $time postgresql
# Required-Stop: $network $local_fs $remote_fs $syslog $named $time postgresql
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: init-Script for WileyMUD
### END INIT INFO
#

PORT=3000
MUDDIR=/home/wiley
PATH=$MUDDIR/bin:/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=$MUDDIR/bin/wileymud
SCRIPT=$MUDDIR/bin/wileyloop
PIDFILE=$MUDDIR/etc/wileymud.pid
STARTDIR=$MUDDIR/bin
LOGFILE=`/bin/date "+$MUDDIR/lib/log/runlog.%y%m%d-%H%M%S"`

test -x $DAEMON || exit 0

case "$1" in
start)
echo -n "Starting MUD Server: WileyMUD"
if start-stop-daemon –quiet –stop –signal 0 –pidfile $PIDFILE –name wileymud –user wiley
then
echo " already running."
exit
fi
/sbin/start-stop-daemon –start –quiet –chuid wiley:users –chdir $STARTDIR –background –pidfile $PIDFILE –exec $SCRIPT – -P $PIDFILE -L $LOGFILE $PORT
echo "."
;;
stop)
echo -n "Stopping MUD Server: WileyMUD"
if start-stop-daemon –quiet –stop –signal 0 –pidfile $PIDFILE –name wileymud –user wiley
then
PID=`cat $PIDFILE`
start-stop-daemon –quiet –stop –signal INT –user wiley –exec $DAEMON –pidfile $PIDFILE –name wileymud
# Now we wait for it to die
while kill -0 $PID 2>/dev/null; do sleep 1; done
rm -f $PIDFILE
echo "."
else
echo " not running.";
fi
;;
restart)
$0 stop
$0 start
;;
status)
if [ ! -f $PIDFILE ]; then
echo "No PID file, game may be down"
ps auxww | grep wiley | grep -v grep
else
ps auxww | grep `cat $PIDFILE` | grep -v grep
fi
;;
*)
echo "Usage: /etc/init.d/wiley {start|stop|restart|status}"
exit 1
esac

exit 0
26 Jul, 2015, Rarva.Riendf wrote in the 3rd comment:
Votes: 0
Do not forget to launch the script with nohup as well.
26 Jul, 2015, quixadhal wrote in the 4th comment:
Votes: 0
Actually, in this case, my script is designed to be run as part of your system's /etc/init.d/ process, at boot time.

I guess I forgot to also show the loop script that this runs…

#!/bin/bash
# 42 is our magic number for not rebooting,
# otherwise we assume it crashed or we said reboot.

PORT=3000
MUDDIR=/home/wiley
PATH=$MUDDIR/bin:/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=$MUDDIR/bin/wileymud
SCRIPT=$MUDDIR/bin/wileyloop
PIDFILE=$MUDDIR/etc/wileymud.pid
STARTDIR=$MUDDIR/bin

cd $STARTDIR
while [ -x $DAEMON ]; do
LOGFILE=`/bin/date "+$MUDDIR/lib/log/runlog.%y%m%d-%H%M%S"`
touch $LOGFILE
chmod 640 $LOGFILE
export MALLOC_CHECK=2
$DAEMON -P $PIDFILE -L $LOGFILE $PORT
STATUS=$?
rm -f $PIDFILE
sync
bzip2 -9q $LOGFILE
sync
if [ $STATUS = 42 ]; then
exit
fi
echo "Status was $STATUS"
sleep 120
done
0.0/4