Jump to content

Home

Dedicated Server-Restart Script For Linux


[KWA]SaVAgE

Recommended Posts

For you Linux N00bs:

 

First do "touch startjk" to create the server startup file.

 

Second do "touch runjk" to create the restart script.

 

 

startjk-- do a "vi startjk" then cut and paste the following.. "./jk2ded +exec server.cfg" NOTE there is a ./ (dot slash) before the name.

 

runjk-- do a "vi runjk" then cut and paste the following..

 

#!/bin/sh

while true

do

./startjk

sleep 10

done

 

After having created both of these files (btw hit shift zz to quit and save the scripts) make them executable by doing the following.. chmod a+x startjk and chmod a+x runjk.

 

 

These both need to be in the main JK2 dir, so now to start your server simply type in ./runjk

 

 

The dot slash are needed btw.

 

Hope this has been helpfull, I recieved about 7 requests for this and rather than replly to each of you I posted here.

 

:deathstar

Link to comment
Share on other sites

I like to have some logging with my restart script, so it looks like this:

 

#!/bin/csh

echo Ok

while 1

date "+%D %H:%M:%S" >> /tmp/jk2_start.log

echo "JK2 Server Started." >> /tmp/jk2_start.log

sh startup.sh

date "+%D %H:%M:%S" >> /tmp/jk2_start.log

echo "JK2 Server crashed, Restarting." >> /tmp/jk2_start.log

sleep 5

end

 

That way I can see exactly how often and when the server has gone down.

Link to comment
Share on other sites

Excellent addition, never even thought of adding logging!

 

 

Originally posted by MatrixCPA

I like to have some logging with my restart script, so it looks like this:

 

#!/bin/csh

echo Ok

while 1

date "+%D %H:%M:%S" >> /tmp/jk2_start.log

echo "JK2 Server Started." >> /tmp/jk2_start.log

sh startup.sh

date "+%D %H:%M:%S" >> /tmp/jk2_start.log

echo "JK2 Server crashed, Restarting." >> /tmp/jk2_start.log

sleep 5

end

 

That way I can see exactly how often and when the server has gone down.

Link to comment
Share on other sites

I'm working on testing a new script that logs the stderr to the same log file so that one can tell exactly HOW the server crashed (ie seg fault, etc). It's written using ksh because csh is dumb and can't separate the stdout from the stderr. *chuckle*

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...