Auto start server on boot and auto restart

Post here if you need help setting up your server, etc.
Post Reply
User avatar
mixnetwork
On Lightcycle Grid
Posts: 22
Joined: Fri Jan 02, 2004 10:26 am
Location: Berlin
Contact:

Auto start server on boot and auto restart

Post by mixnetwork »

Hi Linux experts :)

I have a problem.....:(

I am running 4 armagetron servers on suse linux 9.3, sofar everything works fine.

Now the main server starts automatically on boot, all other servers i must start manually with followig commands:
screen armagetronad-dedicated --configdir /usr/local/etc/games/armagetron-dedicated_sb --vardir /var/games/armagetron-dedicated_sb/var

screen armagetronad-dedicated --configdir /usr/local/etc/games/armagetron-dedicated_t --vardir /var/games/armagetron-dedicated_t/var

screen armagetronad-dedicated --configdir /usr/local/etc/games/armagetron-dedicated_s --vardir /var/games/armagetron-dedicated_s/var

Now I want to make this without the screen command and that all servers start automatically when i reboot the main server.

Further i want that they all automatically restart after 24 hours in an idle time. I know in the config file you can activate this, but it must work for all 4 servers not just for 1.

Could anyone help me here, because i am a real noob for linux and donn't know how to do this.

thanks
Mix...... :)
User avatar
philippeqc
Long Poster - Project Developer - Sage
Posts: 1526
Joined: Mon Jul 12, 2004 8:55 am
Location: Stockholm
Contact:

Re: Auto start server on boot and auto restart

Post by philippeqc »

mixnetwork@gmx.net wrote: Now I want to make this without the screen command and that all servers start automatically when i reboot the main server.
Normally, items to be launched as daemons (ie: process to be run in the background) are done so through init scripts. For me, these are in /etc/init.d . Find the script that start the AA server, and add your 3 lines.
Further i want that they all automatically restart after 24 hours in an idle time. I know in the config file you can activate this, but it must work for all 4 servers not just for 1.
The official answer is something like this:
The servers are not aware of each other, and thus cannot make any decision based on the state of the other ones running. Each server will restart when itself has had an idle time of 24 hours. Just give the same parameter in all the config files.

I'll bite to your comment. Why is it important for you to have all of your server restarted at the same time when all of them passed a period of 24 hours of idle time? You realised that with 4 servers, you could have the theoretical scenario where 1 is popular, and 3 that are never visited, but due to the popular one, not a single one of them would be restarted ever!

Some tips for you:
- dont put all your eggs in the same basket,
- dont put all of your admirals in the same shuttle-craft,
- dont link all of your servers to restart only when all have passed an idle period of 24 hours. ;)

-ph

PS: I am not an admin, so i just answered with my basic common sense. Hopefully i wont be too far from the truth.
Canis meus id comedit.
User avatar
mixnetwork
On Lightcycle Grid
Posts: 22
Joined: Fri Jan 02, 2004 10:26 am
Location: Berlin
Contact:

Post by mixnetwork »

Hi,

Thank you four your comments and help.

I added the lines you told me in the starter script, but it does not seem to work, anyway only the main Armagetron server starts.

About the 4 servers:
You're right 3 of them are regurlaly visited, the fourth i made for a player who helped me a lot, and made this server especially for him with his whishes of settings. This one is not much visited, but that does not matter.
There are already too many server online where nobody ever plays on , I know, but as I said 3 are regurlaly visited by players, so I assume they like the settings there.

thanks you you help anyway, hmmmmm and I must find out how to fix this problem.

Mix....;)
Live is for Living...
User avatar
mixnetwork
On Lightcycle Grid
Posts: 22
Joined: Fri Jan 02, 2004 10:26 am
Location: Berlin
Contact:

Post by mixnetwork »

This is the starter script

Code: Select all

#! /bin/bash
# 
# script to be put in /etc/rc.d to start Armagetron Advanced server process
# tested on Gentoo 2004.4
# Author: Manuel Moos <manuel@moosnet.de>
#

# set -x

# program installation directory
PROGDIR=/usr/local/share/games/armagetronad-dedicated/scripts

# load configuration
. $PROGDIR/rcd_config

# files where PIDs are stored
STARTERPIDFILE=$PIDDIR/armagetronad-dedicated-starter.pid
MAINPIDFILE=$PIDDIR/armagetronad-dedicated.pid

# program to run
BINARY=serverstarter
BINFILE=$PROGDIR/$BINARY
TYPE=server

# log file
LOGFILE=$LOGDIR/armagetronad.log

# delegate to common start/stop/status code
. $RCDDIR/rcd_startstop
this is the second one:

Code: Select all

#! /bin/bash
# 
# script to be put in /etc/rc.d to start Armagetron Advanced server process
# tested on Gentoo 2004.4
# Author: Manuel Moos <manuel@moosnet.de>
#

# set -x

# program installation directory
PROGDIR=/usr/local/share/games/armagetronad-dedicated/scripts

# load configuration
. $PROGDIR/rcd_config

# files where PIDs are stored
STARTERPIDFILE=$PIDDIR/armagetronad-dedicated-starter.pid
MAINPIDFILE=$PIDDIR/armagetronad-dedicated.pid

# program to run
BINARY=serverstarter
BINFILE=$PROGDIR/$BINARY
TYPE=server

# log file
LOGFILE=$LOGDIR/armagetronad.log

# delegate to common start/stop/status code
. $RCDDIR/rcd_startstop

perhaps you could tell me where to add the lines that it works.

thanks

Mix......
Live is for Living...
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

could anyone give me a script that will automatically start a server on boot? i tried making one in bash, it works when i run it, and i placed it in /etc/init.d with all the other on-boot scripts, but it still must be started manually.
Image
Image
Image
User avatar
Lucifer
Project Developer
Posts: 8751
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas

Post by Lucifer »

there's an initscript for it. Please use that. :)
Check out my YouTube channel: https://youtube.com/@davefancella?si=H--oCK3k_dQ1laDN

Be the devil's own, Lucifer's my name.
- Iron Maiden
User avatar
wrtlprnft
Reverse Outside Corner Grinder
Posts: 1679
Joined: Wed Jan 04, 2006 4:42 am
Location: 0x08048000
Contact:

Post by wrtlprnft »

Note that placing a script into /etc/init.d doesn't make it run at start. Traditionally you need to create a symlink to it in /etc/init.6.d (I think, gentoo does it differently and I haven't worked with anything else for quite a while) named S<number><name>.
There's no place like ::1
User avatar
Lucifer
Project Developer
Posts: 8751
Joined: Sun Aug 15, 2004 3:32 pm
Location: Republic of Texas

Post by Lucifer »

Code: Select all

sudo update-rc.d armagetronad-dedicated start 51 S .
Assuming you're running ubuntu, which I seem to recall you saying you ran.
Check out my YouTube channel: https://youtube.com/@davefancella?si=H--oCK3k_dQ1laDN

Be the devil's own, Lucifer's my name.
- Iron Maiden
User avatar
ivantis
Round Winner
Posts: 269
Joined: Mon Mar 03, 2008 2:33 pm
Contact:

Post by ivantis »

hmm... that doesnt work, it just made my computer start really slowly.
Image
Image
Image
Post Reply