PDA

View Full Version : Minilogin, Ports, Shorewall Info


Angelox
10-05-2006, 05:44 AM
In order to figure all this out, I've had to return to my old school of "Hard knocks and Falls"
And here's a summary of stuff i did/learned so you can skip this "course" ;
How to run Minilogin with no Xwindows and the emu - this was simple; first run your start-up, then while you're starting up the emu (have minilogin executable in the same directory your startup files are), in the same shell, type "wine minilogin". don't matter if the other is starting and you see text rolling, just keep typing and press "enter" when you're done. it will all settle down, and Minilogin will eventually take over the shell, and that's why you run it last.
I think I'll try a script, with a delay in it, and finally ends with the minilogin startup.
Shorewall (Firewall) will keep you from accessing your Miniloging via Lan, as it keeps the ports shut down to any type of access. I've come up with these ports;

3306/udp 5999/udp 9000/udp 7000:7010/udp 3306/tcp 5999/tcp 7000:7010/tcp

All works fine now - hope this helps someone else.

Angelox
10-05-2006, 07:31 AM
In your startup script, you can add the lines;

sleep 40
wine minilogin

at the end of the script;
#!/bin/sh

P=`pwd`
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$P"
#make sure we have a place to log
mkdir -p logs 2>&1 > /dev/null

#boot up world
if [ ! -e .lock-world ] ; then
touch .lock-world
./world &
# wait for shared memory to load
sleep 15
fi

#start up the official launcher
if [ ! -e .lock-launcher ]; then
touch .lock-launcher
./eqlaunch zones &
sleep 40
wine MiniLogin.exe
fi



This will run anywhere - at least on my Mandriva distro, anyways

eq4me
10-05-2006, 10:59 AM
You can detach it from the shell.

try


wine MiniLogin.exe > /tmp/Minilogin.log &

Minilogin is now working in the background and its output will be written into /tmp/Minilogin.log. I'll write an propper init script as soon as I have time.

You could also use the command nohup


nohup wine MiniLogin.exe

downside is that the output is always going to nohup.out.

You can find more about shell programming here:
http://www.freeos.com/guides/lsst/index.html

John Adams
10-05-2006, 02:12 PM
First, a disclaimer... I have no idea about Linux, this is my first attempt to write a bash script in 10 years... so forgive me if it's a) not formatted properly, b) fails on your system, or c) can be improved.

My goal was to make one script for start, stop, status, and restarting Emu. I think I have everything working except that last MiniLogin.exe thing. I've tried eq4me's last suggestion, but I am getting a "Failed to open port 5999". If I run wine MiniLogin.exe by itself, I usually get it to work (though, connecting a client *still* isn't quite working hehe...)

Ok, this post is just about the script. So, take this, tweak,and hope it comes in handy. It's a little "heavy", but adds some checks and balances.

#! /bin/bash
# Original Script Author: ???
# Editor: John Adams - 10/2006
#
case "$1" in
start)

if [ -e .lock-world ] || [ -e .lock-launcher ] || [ -e .lock-minilogin ]
then
echo "The emulator appears to already be running ?";
echo "If you are sure the server is not running, delete .lock-world and .lock-launcher."
exit 1
else
if [ "$UID" = "0" ]
then
echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
exit 1
fi
echo "Attempting to start the World..."
if [ -e world ]
then
if [ ! -x world ]
then
echo "world is not executable, trying to set it"
chmod u+x world
fi
if [ -x world ]
then
ulimit -c 99999999
rm -f .world_shutdown
set -x
LNAME="peq" #launcher name
if [ "$1" = "test" ]
then
LNAME="test"
fi
P=`pwd`
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$P"
mkdir -p logs 2>&1 > /dev/null
if [ ! -e .lock-zones -a ! -e .lock-world ]
then
for f in logs/eqemu_*.log
do
if [ "$f" = "logs/eqemu_commands_zone.log" ]
then
continue;
fi
rm -f $f
done
fi
if [ ! -e .lock-world ]
then
touch .lock-world
./persist_world 2>&1 > logs/world &
sleep 15
fi
else
echo "World is still not executable. Fix this!"
exit 4
fi
else
echo "Couldnt find world"
exit 5
fi

# Launcher
echo "Attempting to start Launcher/Zones..."
if [ -e eqlaunch ]
then
if [ ! -x eqlaunch ]
then
echo "Launcher is not executable, trying to set it..."
chmod u+x eqlaunch
fi
if [ -x eqlaunch ]
then
rm -f .zone_shutdown
LNAME="zones" #launcher name
if [ ! -e .lock-launcher ]
then
touch .lock-launcher
./eqlaunch $LNAME 2>&1 > logs/launcher &
sleep 40 #wait on launchers to start minilogin
fi
else
echo "World is still not executable. Fix this!"
exit 4
fi
else
echo "Couldnt find eqlaunch"
exit 5
fi

# If MiniLogin.exe exists, launch it last (Angelox)
echo "Attempting to start MiniLogin.exe . . ."
if [ -e MiniLogin.exe ]
then
if [ ! -x MiniLogin.exe ]
then
echo "MiniLogin.exe is not executable, trying to set it..."
chmod u+x MiniLogin.exe
fi
if [ -x MiniLogin.exe ]
then
rm -f .minilogin_shutdown
if [ ! -e .lock-minilogin ]
then
touch .lock-minilogin
wine MiniLogin.exe > /tmp/Minilogin.log &
fi
else
echo "World is still not executable. Fix this!"
exit 4
fi
else
echo "Couldnt find eqlaunch"
exit 5
fi

fi
;;

stop)

echo "Attempting to stop the World..."
touch .minilogin_shutdown
touch .zone_shutdown
touch .world_shutdown
killall world eqlaunch zone wineserver MiniLogin.exe
sleep 3

if ps ax|grep -e 'w[o]rld' -e 'z[o]ne' -e 'eq[l]aunch' >/dev/null
then
killall -9 world eqlaunch zone wineserver MiniLogin.exe
sleep 2
fi

./cleanipc
rm -f .lock-zones .lock-world .lock-login .lock-launcher .lock-minilogin

;;

status)

if [ -e world.pid ]; then
echo "the server seems to be running"
exit 0
else
echo "the server seems to be stopped"
exit 3
fi
;;

restart)

echo "restart all eqemulator services - not implemented yet"
;;

*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
esac
exit 0

Drop this in your server dir, and run it as ./emu start|stop|status (one of those three options)

Not sure how to do the restart option. Anyone?

Angelox
10-06-2006, 03:49 AM
Some of my zones are not loading fast enough, which results in client crash when booting up the dynamic zones.
An error example;
Zone bootup timer expired, bootup failed or too slow.
When zoning, usually what happens is, the new zone auto-boots and thinks it has the player in the zone. But in reality, the client is crashed for the server taking too long to boot up.
I'm thinking the reason for this is because my machine is too slow on loading all the new data I have added to the given zone (i'm runing a PIII with 1.5gig ram).
This started when I did some changes to loots, and have just about every mob in the game droping something: on big zones like the LoY zones, changes like this are massive and I imagine require extra loading time.

anyways here's a new start up I devised which adds static boot up too the slow loaders;

#!/bin/sh

wine MiniLogin.exe > logs/MiniLogin.log &
P=`pwd`
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$P"
#make sure we have a place to log
mkdir -p logs 2>&1 > /dev/null

#boot up world
if [ ! -e .lock-world ] ; then
touch .lock-world
./world &
# wait for shared memory to load
sleep 20
fi
#start up the official launcher
if [ ! -e .lock-launcher ]; then
touch .lock-launcher
./eqlaunch zones &
sleep 80
fi
./zone gunthak 7006 &
sleep 5
./zone dulak 7007 &
sleep 5
./zone torgiran 7008 &
sleep 5
./zone nadox 7009 &
sleep 5
./zone nurga 7010 &


I know it's crude compared to what you guys posted - so you "pretty" it up :)

And here's a working stop (I kept having port problems with mini-login and the wine-server);

#!/bin/sh

killall wine MiniLogin.exe world eqlaunch zone wineserver wine-preloader
sleep 3

if ps ax|grep -e 'w[o]rld' -e 'z[o]ne' -e 'eq[l]aunch' >/dev/null; then
killall -9 world eqlaunch zone
sleep 2
fi

./cleanipc
rm -f .lock-zones .lock-world .lock-login .lock-launcher

John Adams
10-06-2006, 08:20 AM
FYI Angelox, my Core 4 machine is currently P4 1.5GHz, 512m RAM, and a 40GB Quantum Fireball (I think that's 7200 rpm). I haven't had a zone load problem yet, but I am also not running any x-windows at all. Not sure how this stacks up against your machine.

But of course, now I have a new excuse to visit newegg.com, don't I?

eq4me
10-06-2006, 08:46 AM
Just a shot in the dark:
If you are using IDE disks maybe DMA isnt turned on.

To check the rough speed of your disk(in this example /dev/hda) install the package hdparm and do


hdparm -Tt /dev/hda


The "buffered disk reads" should be well over 20 MB/s with any halfway modern harddrives.

If they arent check if DMA is turned on.


hdparm /dev/hda


"using_dma" should be 1. If not you have an huge disk I/O performance penalty.

More in this guide, its slightly gentoo specific but quite good
http://www.gentoo-wiki.com/HOWTO_Use_hdparm_to_improve_IDE_device_performance

Angelox
10-06-2006, 08:55 AM
FYI Angelox, my Core 4 machine is currently P4 1.5GHz, 512m RAM, and a 40GB Quantum Fireball (I think that's 7200 rpm). I haven't had a zone load problem yet, but I am also not running any x-windows at all. Not sure how this stacks up against your machine.

But of course, now I have a new excuse to visit newegg.com, don't I?
Your pc is much more up to date, mine is way behind (P3 875MhZ) - the problem is there,x-windows or not. my 1.5 gig of ram will not make it run any faster, just buffer things and help out with the static zones.
That's just what I use for a server, I do have my personal machine which is P4 2.5 GhZ, but I don't want to turn it into any kind of a server.
I "almost" have a P4 Celeron put together - All I need is a motherboard. I had bought one on sale, one of those "as you see" no return" deals, but turns out it's for Pentium 4 CPU only, and not Celeron. So now I have a nice, shiny new MB to look at. When I get that one running , I'll move everything to there.

Angelox
10-06-2006, 09:04 AM
Actually, the static zones are pretty nice, gives you a more realistic view of the game (as in Live); mobs that get killed re-spawn again within their time limit , even if the zone is empty. Also, if a named mob is up, you can get killed, then come back try kill him again, but if you're dynamic, the zone re-boots when you die, and it's all over.

fathernitwit
10-15-2006, 06:38 AM
John, few comments about your script:
1) I wrote the original :-)
2) I would move the LNAME code up to the top of the script, its really a configuration, not a start thing...
3) the LNAME test condition needs to be change to $2 instead of $1 since you added start/stop to the cmdline
4) when you stop minilogin, im pretty sure you need to be killing wine, not MiniLogin.exe. But that might upset things if they are using something else in wine... might wanna grep for the pid or something.

Angelox: booting zones directly really isnt advised... especially on linux... the launcher is designed to automatically inject delay into zone booting to prevent your problems.

John Adams
10-17-2006, 12:47 AM
FNW, thanks. I will make the changes, test them, and WIKI this script.

Angelox
10-17-2006, 01:01 AM
FNW, thanks. I will make the changes, test them, and WIKI this script.
At the end, you do have to kill the whole wine server, so it gives up the port minilogin uses- I don't use wine of that machione for anything else so it's not improtant for me to keep it running;
My latest stop-script;
#!/bin/sh

killall wine MiniLogin.exe world eqlaunch zone wineserver wine-preloader
sleep 3

if ps ax|grep -e 'w[o]rld' -e 'z[o]ne' -e 'eq[l]aunch' >/dev/null; then
killall -9 world eqlaunch zone
sleep 2
fi

./cleanipc
rm -f .lock-zones .lock-world .lock-login .lock-launcher

sleep 3
killall wine-preloader
sleep 3
killall wine-preloader
sleep 3
killall wine-preloader

The third "killall wine-preloader" returns the error that the job is done.

John Adams
10-17-2006, 02:22 AM
At the end, you do have to kill the whole wine server, so it gives up the port minilogin uses-
Oh yes, now I remember. I did just kill MiniLogin.exe, and could never launch it again (said it couldn't open port 5999) until Wine died. I'll just make a note that this may destroy any other Wine apps unless the PID thing mentioned specifically kills just that one instance.