Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   CoD Multiplayer (http://forum.fulqrumpublishing.com/forumdisplay.php?f=192)
-   -   Auto-restarting CloD server with AutoIt (http://forum.fulqrumpublishing.com/showthread.php?t=25429)

Ataros 08-15-2011 07:03 AM

Auto-restarting CloD server with AutoIt
 
AutoIt is a popular windows automation toolbox which can be scripted to do various tasks. BigRepa created a script for it to restart Repka servers.

What it does:
1. Checks if launcher process exists
2. Checks if there is no Steam disconnect window pop-up.

If 1 or 2 is not true, it runs reboot.cmd which restarts Windows.

Code:

#Include <WinAPIEx.au3>
Opt("TrayAutoPause",0) ; important line!
$okno="Steam Connection"
While 1
If Not ProcessExists('Launcher.exe') Then
sleep (300000)
        If Not ProcessExists('Launcher.exe') Then
        Run("C:\autocod\reboot.cmd")
        Endif
Else
        $var = WinList($okno) 
        For $n = 1 to $var[0][0]   
        $aData = _WinAPI_EnumChildWindows($var[$n][1])
        For $i= 1 To $aData[0][0]
        $text=ControlGetText ($var[$n][1], "", $aData[$i][0])
        If StringInStr($text, "Steam") Then
        Run("C:\autocod\reboot.cmd")
        Endif
        Next
    Next
    sleep (60000)
Endif
WEnd

You also have to put the following files into the script directory:
APIConstants.au3
WinAPIEx.au3
Get them at AutoIt site. AutoIt forums provide a lot of help and instructions.

I personally did not install or ran it. Just spread some useful info.

Ataros 08-15-2011 07:28 AM

Update.

reboot.cmd restarts Windows
Code:

shutdown /r /t 5
Windows autostart contains:
1) AutoIt script
2) Steam
3) .cmd file starting launcher and mission in it with tst10.exe program (scripted telnet ?)

Code:

timeout 180
CD C:\Program Files\Steam\steamapps\common\il-2 sturmovik cliffs of dover\
start /high Launcher.exe -server
cd C:\autocod
echo %date% %time% restart server>> repka_log.txt
timeout 15
tst10.exe /r:Start-Mission.txt /m

2 daily server restarts are scheduled via Windows Task Scheduler at 07.00 and 19.00 MSK just in case.

All 2 Repka servers are running a desktop versions of Windows (Win7-64 probably) for compatibility with some online missions (e.g. 2nd campaign by stillborn). All 3 are run on one physical server on virtual machines that allows running 3 copies of Steam on the same hardware at the same time.

Ataros 11-22-2011 12:06 PM

Another AutoIt script by gec:

http://forum.1cpublishing.eu/showthr...d=1#post363628

Ataros 11-22-2011 12:41 PM

Current version by BigRepa
Code:

#Include <WinAPIEx.au3>
Opt("TrayAutoPause",0)
$okno="Steam Connection"
$okno2="Error"
$okno3="Microsoft Windows"
While 1
If Not ProcessExists('Launcher.exe') Then
sleep (300000)
        If Not ProcessExists('Launcher.exe') Then
        Run("C:\autocod\reboot.cmd")
        Endif
Else
        $var = WinList($okno) 
        For $n = 1 to $var[0][0]   
        $aData = _WinAPI_EnumChildWindows($var[$n][1])
        For $i= 1 To $aData[0][0]
        $text=ControlGetText ($var[$n][1], "", $aData[$i][0])
        If StringInStr($text, "Steam") Then
        Run("C:\autocod\reboot.cmd")
        Endif
        Next
    Next
        $var = WinList($okno2)
        For $n = 1 to $var[0][0]   
        $aData = _WinAPI_EnumChildWindows($var[$n][1])
        For $i= 1 To $aData[0][0]
        $text=ControlGetText ($var[$n][1], "", $aData[$i][0])
        If StringInStr($text, "Steam") Then
        Run("C:\autocod\reboot.cmd")
        Endif
        Next
    Next
    $var = WinList($okno3)
        For $n = 1 to $var[0][0]   
        $aData = _WinAPI_EnumChildWindows($var[$n][1])
        For $i= 1 To $aData[0][0]
        $text=ControlGetText ($var[$n][1], "", $aData[$i][0])
        If StringInStr($text, "Отмена") Then
        Run("C:\autocod\reboot.cmd")
        Endif
        If StringInStr($text, "Закрыть") Then
        Run("C:\autocod\reboot.cmd")
        Endif
        If StringInStr($text, "Отправить") Then
        Run("C:\autocod\reboot.cmd")
        Endif
        Next
    Next
    sleep (60000)
Endif
WEnd


_79_dev 07-10-2012 08:31 AM

Hi Ataros, there seems to be problem with that latest script. I am getting error:

Code:

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\autocod\back\error.au3"
C:\autocod\back\WinAPIEx.au3 (8108) : ==> Duplicate function name.:
Func _WinAPI_DuplicateHandle($hProcess, $hSource, $hTarget, $iAccess = 0, $iOptions = 2, $fInherit = 0)

>Exit code: 1    Time: 0.315

Would You be able to ask BIGRepa wich function is wrong?

Ataros 07-19-2012 07:02 PM

Hi!
sukhoi.ru is down and I can not contact BigRepa. AFAIK he does not use these scripts any more as Small_Bee wrote a server commander which is being beta-tested.

You can ask at AutoIt forums I think. They have a great community there. BigRepa learned everything from their forum.


All times are GMT. The time now is 04:01 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.