[release]Server maint tool

09/08/2012 18:12 PowerChaos#1
Dear users

lets release a simple tool to do server maint

First of all you need to have a little knowledge about winows

This tool use CMD file and windows CronJob ( Shedule Task )

ok lets explain how to do it

on your desktop or any other place , right click and create a new TXT file

open the TXT fie and fill in the below information

Code:
@ echo off
title Server Maint
color 90
echo Server maint in progress
taskkill /f /im AccountServer.exe
waitfor /t 2 Closing 
taskkill /f /im MsgServer2.700.exe
waitfor /t 2 Closing
taskkill /f /im npc.exe
waitfor /t 2 Closing
START /D "C:\Documents and Settings\Administrator\Desktop\server\ACCServer" AccountServer.exe
waitfor /t 10 AccountServer
START /D "C:\Documents and Settings\Administrator\Desktop\server\GameServer" MsgServer2.700.exe 
waitfor /t 30 MsgServer
START /D "C:\Documents and Settings\Administrator\Desktop\server\GameServer" npc.exe 
waitfor /t 30 npc
echo Server Maint Completed
exit
now lets explain what the code does and what need to be changed

Code:
taskkill /f /im AccountServer.exe
above code need to be changed
Change the AccountServer.exe to the name of the program

You can see the program names in task manager
in my case it is called AccountServer.exe ( notice caps ?)
fill that in for the NPC / MessageServer and AccountServer

if that is done , lets move to the next step

Code:
START /D "C:\Documents and Settings\Administrator\Desktop\server\ACCServer" AccountServer.exe
Start /D = start command
"c:/....." Your location of your server MAP
AccountServer.exe = The name of the program ( no quotes )

Change them to the right value as above

Code:
waitfor /t 10 AccountServer
It is a sleep command to wait for 10 seconds or to wait until it find AccountServer (not working ) , in most cases it will just time out and continue after the timeout
Leave those value's as basic exept if your server is heavyer , then adjust the value as needed ( message server on 120 is recommerd )


Safe the file and rename it to maint.BAT

Now lets set up the automaint tool

Open Sheduled Tasks ( control panel / sheduled tasks -> new task )

There you can follow the wizzard and click on next
on the screen it ask you to select a file , click on browse and select your fresh created BAT file

Now Select Weekly as option
Setup the time and the days you like to run the command

as soon that is done , then you got your auto maint tool
it seems a lot of work , but it is easy to be done

Please note , if it does not work , then follow the guide again as NOTHING can go wrong if you provide the right value's (keep in mind that "waitfor /t 10" -> time it waits before it continue to next command )

enjoy

Greetings From PowerChaos
09/08/2012 20:53 Zodiao#2
Thats pretty easy :). i already knew it . ppl wont use it

just because itss complicated.
09/09/2012 16:39 PowerChaos#3
if they call this complicated then they are not worth to be a server owner

how hard can it be to right click and create a new file :s

copy/paste and change a few lines , and change the name to BAT

but i guess there are exeptions

Greetings From PowerChaos
09/10/2012 08:54 XxFearReaperXx#4
to be honest, thats kinda stupid to use task kill on msg server. The msg server needs to close normally so it can write the rest of the data to the database, if you kill the task, you lose data and risk losing players because they lose stars/eps/items. How about instead of that, You create an Auto Maint tool with Auto Hot Key.
09/10/2012 12:11 PowerChaos#5
if you preffer i can release the non compiled version of autohotkey that sends a broadcast for 3 min before it shut down the message server and the npc/account server ?
but the problem is to get that working that you need to have exact the same server as i have, or you need to know how to manual edit it and thats the same as this batch file

but if you look at the message server response , if you press the close button then it try to close the message server for 30 seconds before it also force kill it ( time is up , exit now in 3 seconds )

so far i noticed that only the mysql data get corrupt if you also force close the mysql service
but if you force close the message server then so far it should be fine (not tested under heavy load or with a lot of players)

i see no reason why i would release the hotkey script to other users when they should be able to write it on there own

use the hotkey script with the batch file to start up or use the hotkey script itself to start up
There is only 1 small problem and why i still love the taskkill as backup
the script lags sometimes and miss the button it need to press , so a forcekill also kills the server in case the script can not press the button (in case something goes wrong then the maint does not fail :D )

Greetings From PowerChaos
09/18/2012 05:37 hio77#6
task killing always runs risk of data loss/corruption.. personally, ild have a autoit script kick everyone, close the server nicely, and then run any other tasks before starting.

all of this can easily be done, nomatter the shape or look of your exes, depending on the way it is scripted. AHK has a few issues achieving that.

on a production server, i dont see an issue with using this, the lost data wont be important. but a public one, you should have yourself your set method and time of rebooting the servers.

using this on a public server, is well promoting more lazy ways of managing a server really.

from my own personal experience, task killing a server can damage alot, making habbit of this is asking for trouble.

-hio