Sign in to follow this  
Higgins909

What is the best way to auto restart a server?

7 posts in this topic

What I'm looking to do:

Have the server restart every 3 hours.

Have warning messages.

 

I've already got it setup to do messages and shutdown, through the exile server config. (not a fan of the tiny restart msg it comes with)

But right now I have no way of restarting it.

 

I noticed one by Kugane, but don't think it will work, as my log or rpt file? is setup to big one huge log file that resumes every restart.

massasster has me a bit confused... but I think he has it setup to restart the whole server, which I don't want.

I'm not really sure how launching the server from crontab will work?  I thought the server needs a screen to run? (which I run it though a "screen -S")

I'm on ubuntu server 14.04 I think it was...

Is there a simpler version anywhere?

 

 

Edit: I also heard about BEC but hear it's windows only? (I hate how everything is windows...)

Edited by Higgins909

Share this post


Link to post
Share on other sites

on ubuntu the best way is to use cron, you can access cron by type cron -e in terminal.
Full details here:
https://help.ubuntu.com/community/CronHowto


Exile Specific cron/shell scripts:
http://exile.majormittens.co.uk/topic/185-linux-restart-script-for-exilemod/

Cron just runs a .sh (shell script)
Like you said is to run the arma server in screen so that the server can be completely headless (if you want)
Here is some example code that uses screen to run my mining cluster management interface.

#!/bin/bash
cd /root/master
screen -dmS mojo
sleep 5
screen -p 0 -S mojo -X stuff "bash
./mojo
" &
sleep 60
export DISPLAY=':1'
xrandr -s 640x480
xterm -geometry =80x24+10+10 -fn 8x13 -j -fg white -bg black -e screen -x mojo

But really, for arma, this can be trimmed down to:
#!/bin/bash
cd /root/master
screen -dmS arma
sleep 5
screen -p 0 -S arma -X stuff "bash
./arma3server -commandoptions-mods-ect
"

Edited by wasti
  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Using cron jobs has so many issues.. 

  A bit ago I asked Chris (Infistar) to add an option to infistar to #shutdown the server after xxx minutes.  I got away from cron because it's a set time the server is going to reboot and doesn't take into account any server crashes that cause the server to reset (and the timer).

 

moved on to simple script to monitor the server and start it when needed

 

#eck if server is running

while true; do

if pgrep arma3server >/dev/null 2>&1
  then
     echo "arma3server running"
 else
     echo "arma3server not running sending restart"
cd /home/steam/steamcmd/arma3server2/
./arma3server2 -maxmem=2047 -config=server7.cfg -port=2315 -autoinit -mod="@Exile;@AllInArmaTerrainPackLite;" -servermod="@ExileServer;@A3XAI;@infistar;@AllInArmaTerrainPackLite;"&


fi




echo "sleeping 2 minutes"
sleep 2m
done

 

Edited by massasster
  • Like 1

Share this post


Link to post
Share on other sites

and well it does not restart the whole server. it only restart the server script.

I have a CentOS 7 server where i host some projects on but also arma 3 exile and when the restart comes for the game it only effects the exile server and not a tiny bit of any other aspect of the server itself where i run my other projects.

 

and for the log yea just create a script that will clean that directory when it comes to a certain amount of size.

because u still need the log for a while.... never know

Share this post


Link to post
Share on other sites

Why not just use ? http://supervisord.org/ its the fastet way and it all ends up in a config file like this ...

 

Quote

[program:exile_server]
directory=/home/path
command=/home/path/arma3server -config="@exileserver/config.cfg" -mod=@exile -servermod=@exileserver -autoinit
process_name=%(program_name)s
autostart=true
autorestart=true
stopsignal=SIGINT
user=*

 

Share this post


Link to post
Share on other sites

Im not familiar with a3 servers + exile on ubuntu but i use ubuntu at work and for much projects that are not related to gaming. There i use cronjobs for cleanup routines and supervisord for everything that has to be monitored if it is running and if something is not running start it again.

i think it should be easy to configure it to your needs.

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.