Jump to content
Sign in to follow this  
Gugus

Auto-restart standaloneserver when hang-up

Recommended Posts

They need to setup a server.cfg like are explained in the DS-Admin.rtf file that comes with the stand-along server.

There is option to give the server a name.

Share this post


Link to post
Share on other sites

I figured it out and got it to do what I wanted.  

I had a .cfg from the start, but the command to set the hostname is not documented in the .rtf file.  I had to learn the hostname command from a third party website.

Also the other part of the problem was that I didn't have port 2235 open.  Again I found this from a third party, as it is not documented by BIS.

I hope BIS will rectify these omissions in the documentation.

Thx again. My server is running very nicely now. smile.gif

Share this post


Link to post
Share on other sites

related question - how to get rd of dialogue box.

I am hosting two servers on the same PC and to restart after a crash I use the a bat file,

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">

:start

start /W ofp_server.exe

goto start

<span id='postcolor'>

The problem is that sometimes one of the servers hangs rather than crashes. This means that the server will not restart until I can get to it (many miles away).

I have tried using a little prog called shutdown that works but only if one of the server has not hung - otherwise the whole thing hangs with a dialogue box. Suggestions welcome

BTW i have very few ports open sad.gif

Share this post


Link to post
Share on other sites

Make sure that Dr. Watson for Win2K, etc. is disabled. Here's a link to the Miscrosoft article on how to do that:

http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q188296&

Dr. Watson will make the server hang while it does whatever in the funk it's supposed to be doing. About the only thing that I've ever known Doc Wat to be good for is hanging processes and programs.

Share this post


Link to post
Share on other sites

You dont totally need to disable drwatson, just take the visual notification off.

To do that do start/run and type "drwtsn32", and unselect "visual notification". also disabling all crash dumps and such might be a good idea (OFP still makes its own flashpoint.rpt and context.bin in case of a crash)

Share this post


Link to post
Share on other sites

OK

Now we run on Linux.

How do I get

:start

start /W ofp_server.exe

goto start

to work in Linux Shell?

Probably BASH, not sure.

Lt_Dan_Sweden

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (BigQEd @ April 10 2002,05:47)</td></tr><tr><td id="QUOTE">ErrorControl and FailureActions have to do with allowing/making the service automatically restart when service crashes/exits.

I have setup a tutorial for OFP Server based on the afore-mentioned tutorial. I made a REG file for OFP to make easier for the OFP community. I also place the needed files on our FTP server.

This is a bit more difficult than FireDaemon... BUT if you wish to run a server properly then this seems the best way to do so.

Visit http://www.fraghaus.com/runasservice.htm<span id='postcolor'>

Hey BigQEd,

Have you seen issues running OFP Ded. Server at higher priority? When I used to use a script to run OFP at higher priority hosting games (non ded) I ran into problems where it'd take forever for myself to connect to the server. How do you run at higher priority if running as a service?

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (BigQEd @ April 04 2002,01:19)</td></tr><tr><td id="QUOTE">You are correct Keg...

I am sure those that log on to their servers might like the Batch file idea. smile.gif I simply prefer to run as a Service because all our Servers are in our NOC and not systems we utilize as Desktop systems.<span id='postcolor'>

BigQEd, you're right that most FTP, Web, etc. server applications for Windows run as services, and they work best that way because that's how they're designed to run.

The problem with running a game server like OFP as a service, is it has *not* been designed to run that way. If any errors occur while the server is running, there's no way you'll know about them, because it has no logging; only on-screen visual alerts. If you're running as a service then you can't see the console and you can't see these alerts.

By contrast, something like IIS which is designed to run as a service will log all errors to the system Event Log (or a separate log file), so you can read them.

Pop-up alerts are unfortunately quite common with the OFP server if you're not careful (I consider this something of a design flaw on BIS's part); all you need is a mission file with an error (missing resource, addon etc.) and you get a popup alert box. The alert prevents the server from running, but doesn't end the process, so it won't be auto-restarted. If you're running as a service, you presumably just have to guess at the problem.

Background processes are not "more efficient" than foreground processes. The only difference would be if you have Win2K Server set to optimize for background services, they might get some kind of higher priority (not sure exactly what that switch does, actually). If you set that to optimize for foreground applications, then it will be the other way around. There is nothing inherently better about background processes, as far as I know. It's more of an application design issue; if you just force a foreground application to pretend to be a background service, you gain few or none of the actual advantages of having a background service (only good thing I can think of is the program can be set to start up at reboot automatically--but servers shouldn't be rebooting often enough for that to matter).

I have a few custom programs for restarting and monitoring our various game servers, but for OFP we're actually just using the freeware ServerDoc. It's simple and works well enough. Effectively the same as the batch file, but with a few extra features.

smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Lt_Dan_Sweden @ Oct. 15 2002,22:57)</td></tr><tr><td id="QUOTE">OK

Now we run on Linux.

How do I get

:start

start /W ofp_server.exe

goto start

to work in Linux Shell?

Probably BASH, not sure.

Lt_Dan_Sweden<span id='postcolor'>

This does the trick in Linux:

#!/bin/bash

while (1); do

./ofp_server

done

I'd suggest running servers within a 'screen' session under Linux. Make two scripts, one with the above (call it loop.sh) and one with commands to open a screen (call it start.sh):

#!/bin/bash

name=opflash

screen -c ./screenrc -S $name su -c -- games ./loop.sh

Now make another file called screenrc with some suggested screen config info in it:

scrollback   2000

bindkey \003 detach

bindkey \033 detach

detach

Now run ./start.sh. This creates a screen session called 'opflash' and runs the server as the 'games' user, then detaches the session. You can log out and the server will continue running. Typing:

screen -r opflash

...will reattach the screen. You can push Esc to detach again.

You'll need the 'screen' package installed on your system of course for this to work.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">If any errors occur while the server is running, there's no way you'll know about them, because it has no logging; only on-screen visual alerts. If you're running as a service then you can't see the console and you can't see these alerts.

<span id='postcolor'>

Ehh.. As far as I know "Flashpoint.rpt" shows those logs. wow.gifwow.gif

As for those who cannot make the service restart automatically: Make sure you run FlashpointServer.EXE and NOT the .BAT-file!. smile.gif

Regards

EazyOne

Share this post


Link to post
Share on other sites

For Linux Server

create a file named:  res190

containing the code below

Set file to be executable...

chmod 775 res190

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#!/bin/bash

#

# Start up the Resistance Linux Server

# and restart it if it falters

#

# it might be best to invoke this with nohup and put it into the background

#

#  nohup ./res190 &

#

echo -n "Starting res190 script at " > res190.log

date >> res190.log

# make sure it's not already running

killall -9 server

while :

do

 echo "Starting Res 1.90 Server..." >> res190.log

# edit the following line to invoke Res 1.90 with the parameters

# you want it to run under

./server -config=server.cfg -port=2302

# writes to the log when server crashes

 echo -n "Res 1.90 crashed at " >> res190.log

 date >> res190.log

 sleep 30

# make sure it's really 100% dead.

 killall -9 server

 sleep 60

done

<span id='postcolor'>

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Egor @ Oct. 18 2002,05:22)</td></tr><tr><td id="QUOTE">I'd suggest running servers within a 'screen' session under Linux. Make two scripts, one with the above (call it loop.sh) and one with commands to open a screen (call it start.sh):<span id='postcolor'>

I can highly recommend Egors two-script auto-restart. When using it you can access your server with SSH and see the live server log/prompt. Really great stuff.

Share this post


Link to post
Share on other sites

Im having a problem with running a permanent server with Linux.! sad.gif

Cant make Egors solution to work, and if I use Solarix, the server will stop when I shut down Putty!..

Any ideas ?... Isnt it possible to run as a service aswell as in windows?..

(Im running Redhat 8 installed as a server).

/EazyOne

Share this post


Link to post
Share on other sites

I am not sure which method i use to restart my Linux server. Although it seems to be Like Egor suggests.

I can send you my start.sh and stuff to your e-mail (when i get home from work)

I just putty in and type start.sh - server works lovely.

If i need to stop it i just kill loop.sh and it stops instantley.

If Joltan replies to this thread he might have more idea - he set it up - but only from info in this thread.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Skunk Monkey @ Feb. 13 2003,10:55)</td></tr><tr><td id="QUOTE">I am not sure which method i use to restart my Linux server. Although it seems to be Like Egor suggests.<span id='postcolor'>

We're using Egors solution (yes, copied from this thread). I also had to use 'while(true)' to get it running.

loop.sh:</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">#!/bin/bash

while (true); do

./server -config=server.cfg

done<span id='postcolor'>

start.sh:</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">#!/bin/bash

screen -c ./screenrc -S opflash ./loop.sh<span id='postcolor'>

screenrc:</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">scrollback 2000

bindkey \003 detach

bindkey \033 detach

detach<span id='postcolor'>

All files are located in the server directory. Also don't forget to do a 'chmod u+x' on the two shell scripts...

wink.gif

Share this post


Link to post
Share on other sites

alrite, I got the 2-script solution to work...

only problem... it created 2 more servers... !.. I MIGHT not have stopped it the right way or somethin.. but after a : killall loop.sh, and I started it again, it creates 2 SEPERATE servers again.. And ppl are actually able to connect to either one.. hosting two different maps!.. (no wonder we had 2FPS at te server I was playing on!.. crazy.gif )

So now i run server with Solarix´script, but then I cant shutdown puTTy without loosing the server aswell. sad.gif

Guess I gotta go learnin BASH the hard way!. tounge.gif

Share this post


Link to post
Share on other sites

killall start.sh (should not be needed, but do it anyway)

killall loop.sh (this prevents an extra server to be started, when the server is shut down. Must be run previosly to next command, killall server)

killall server (this shutdowns all running servers)

make sure all servers are down, by either executing the command "top" or try connecting to the server with ofp. If all is down. Run "start.sh" again.

Now you can shut down Putty, without the server shutting down.

Putty can be found

HERE

Share this post


Link to post
Share on other sites

I just helped Dave from OFPladder out, and on some distributions, Red Hat, you need to change

#!/bin/bash

into

#!/bin/bash2

to make the scripts work.

Share this post


Link to post
Share on other sites

I don't know about older versions of dos/windows, but this:

:start

start /W ofp_server.exe

goto start

will time out on XP after a while...  confused.gif

Share this post


Link to post
Share on other sites

ok now we got that settled....I think?? is there away of having a linux server reset it self without have to login with putty....same as windows operates by using a bat file ? rock.gif

Share this post


Link to post
Share on other sites

make a start.sh file containing :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(while [ ! -f server.stop ]; do

./server -config=server.cfg

done

rm -f server.stop

) &

Make it executable. The server will restart when crashed.

Make a stop.sh containing :

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">touch server.stop

PID="`ps -fe | grep 'server -config=' | grep -v grep | awk '{ print $2; }'`";

kill $PID 2>/dev/null

use it to stop the server.

Whis'

Share this post


Link to post
Share on other sites

we just switched to the service, I see some actual improvments with the settings I chose

but then we're on a 800 mb line with a 3.0 ghz HT FSB 800 and 1 gig dual DDR PC400mhz

less crashes too for some reason

Share this post


Link to post
Share on other sites

UPDATE ON LINUX SERVER SCRIPT

create a file named: res191

containing the code below, make sure it is in the same folder as server file

Set file to be executable...

chmod 775 res191

Execute the Script like this...

nohup ./res191 &

Code Sample

Quote[/b] ]

#!/bin/bash

#

# Start up the Resistance Linux Server

# and restart it if it falters

#

# it might be best to invoke this with nohup and put it into the background

#

# nohup ./res191 &

#

echo -n "Starting res191 script at " > res191.log

date >> res191.log

# make sure it's not already running

killall -9 server

while :

do

echo "Starting Res 1.91 Server..." >> res191.log

# edit the following line to invoke Res 1.91 with the parameters

# you want it to run under

./server -config=server.cfg -port=2302

# writes to the log when server crashes

echo -n "Res 1.91 crashed at " >> res191.log

date >> res191.log

sleep 30

# make sure it's really 100% dead.

killall -9 server

sleep 60

done

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×