Page 1 of 2

auto restart login game server (linux)

Posted: Wed Jun 22, 2011 2:17 pm
by diablodoro
hello
can some one tell me is it possible to do something like 2 "sh" file

1rst can enter telnet restart the login server

second file that enter telnet make massage like "server restart 5min" then make command restart 300

and this 2 files do this like for LS every hour and for the game server like every 12 hour or something like this

it will be good if the script have timer that show ho much time left until restart something like
LS : 50min 40min 30min 20min 10min 5min 3min 2min 1min
GS: 12hour 6hour 3hour 1hour 30min 15min 10min 5min 3min 2min 1min

or something like this

Re: auto restart login game server (linux)

Posted: Wed Jun 22, 2011 2:21 pm
by diablodoro
somting like this

Code: Select all

#!/bin/sh kill `ps xa | grep GameServer_loop | grep -v grep | cut -d' ' -f 1`kill `ps xa | grep LoginServer_loop | grep -v grep | cut -d' ' -f 1`killall javacd /usr/local/L2/gameserver/./startGameServer.shcd /usr/local/L2/login/./startLoginServer.sh

Re: auto restart login game server (linux)

Posted: Wed Jun 22, 2011 4:43 pm
by diablodoro
hmm when i think about it

Code: Select all

#!/bin/sh (echo "password"; sleep 3; echo "restart"; sleep 3; echo "exit") | telnet 127.0.0.1 123456 
this is better the command its working five whit LS GS CS but i don't know how to make "cron" to reload it on the time i wish

Re: auto restart login game server (linux)

Posted: Thu Jun 23, 2011 12:42 pm
by diablodoro
The script is done.

login server

Code: Select all

#!/bin/sh (echo "password"; sleep 3; echo "restart"; sleep 3; echo "exit") | telnet 127.0.0.1 12345 
game server

Code: Select all

#!/bin/sh (echo "password"; sleep 3;echo "announce 12h auto restart" ; echo "restart 300"; sleep 3; echo "exit") | telnet 127.0.0.1 12345 
I made the login server restart every 15 min and the game server restart every 12hours.
Therefore i used the Linux program "Schedule Task"; it's very easy to use and more stable and the best thing is that it can't crash and loads automatically on startup

how to use it :
1 install
2 open
3 select "New"
3 select "A task that launches recurrently"
4 Description: write something that reminds you about the process
5 command: to make the program work you need to enter a command such as "$HOME/L2J/Startup!/login_restart.sh"
6 Default behavior
7 select the time
8 click 'add'
9 and wait :)

I hope it will be of use :)

Re: auto restart login game server (linux)

Posted: Mon Jun 27, 2011 7:52 am
by bomberoloco24
Thanks for this, it seems very symple and very usefull. ill give it a try.

Re: auto restart login game server (linux)

Posted: Mon Jun 27, 2011 11:10 am
by lion
diablodoro wrote: I made the login server restart every 15 min
:shock:

Re: auto restart login game server (linux)

Posted: Mon Jun 27, 2011 3:50 pm
by Opiam
How I can make the autostart for servers after system reboot?
ubuntu systems.

Re: auto restart login game server (linux)

Posted: Mon Jun 27, 2011 5:14 pm
by MELERIX
you can use global task for restart.

viewtopic.php?f=41&t=20738

Re: auto restart login game server (linux)

Posted: Mon Jun 27, 2011 5:23 pm
by Opiam
MELERIX wrote:you can use global task for restart.

viewtopic.php?f=41&t=20738
Thx. But it's not what I want.
For Example: my server's working, and suddenly he fell (power's off), my mego hoster - stand up, and deploy it. Then L2J Servers must up, in automatic mode, without user intervention.

Re: auto restart login game server (linux)

Posted: Mon Jun 27, 2011 5:38 pm
by MELERIX
not a good idea to do that.

because some tables could be damaged (due power off), and if you start server with damaged tables, for example "items" or "characters" tables, db cleanup (on server start) could damage your whole db.

Re: auto restart login game server (linux)

Posted: Mon Jun 27, 2011 7:52 pm
by Opiam
MELERIX wrote:not a good idea to do that.

because some tables could be damaged (due power off), and if you start server with damaged tables, for example "items" or "characters" tables, db cleanup (on server start) could damage your whole db.
What you thinking about backups. Is it a variant?
Can you write for my and another megа programmers bush for Unbunty OS with check with a good connection to the database tables or something like this... please help me, becouse after some days I will not have enough time for watching for my serv...

Re: auto restart login game server (linux)

Posted: Tue Jun 28, 2011 11:18 pm
by diablodoro
well you can make this for backup

make the server.sh and game.sh start on startup
then you can make the script not to restart the server but to shut it down
then you can make the PC restart

and you get this

server restart 300 sec
after 300 sec it will delay 10-20 sec more in case of something go wrong
after the server is down you tell the hour mysql to make back up
afther the back up is ready you make the PC restart
then when the PCstart it load the login.sh and game.sh automatick

PS: backup don't take more then 30 sec the system restart on linux is 10 sec max the startup of the server is from 90 to 120 sec and +from 30 to 60 sec for delay you will get everything done for like less then 5 min i think its great to make full restart time a day :)

and you get
1 full restart
2 backup
3 you do it fully automatic

its not so hard you can do it on every system
and the most easy way is to use terminal

if you need more help you are welcome to pm :)

PS2 i made some event autostart whit this command this save GM online time :) and players are happy that event is on time :)

Re: auto restart login game server (linux)

Posted: Tue Jun 28, 2011 11:19 pm
by diablodoro
best back up is on shutdown server this way you are sure that the back up is 100% and something is not missing :) most servers make backup 2 times a day

Re: auto restart login game server (linux)

Posted: Wed Jun 29, 2011 12:05 pm
by Opiam
diablodoro wrote:best back up is on shutdown server this way you are sure that the back up is 100% and something is not missing :) most servers make backup 2 times a day
What's the difference when you make a backup of db, when server's on or off?
After a restart everything will fall into place.

Re: auto restart login game server (linux)

Posted: Wed Jun 29, 2011 2:59 pm
by Scepter
tbh if your working from a server that doesnt have a UPS, your kinda asking for trouble during a powercut. with a strong enough UPS you can keep the server running normaly for upto 48 hours which would meen you wouldnt have to worry about a powercut, if the hosting company doesnt have one it would be wise to switch providers.

if its a home pc, well then i guess you could make edits to your system files (not recomended) where on startup it runs the server startup files (again not recomended)