Page 1 of 1

Automatic restart of EQ2World [Win32]

Posted: Tue Dec 01, 2009 3:17 pm
by bolly
This is a small windows script to automatically start your server when it dies. You should add this into scheduled tasks and tailor it to your needs.

Executing this vbs script should be done using the cscript executable that comes with most versions of windows

Syntax: cscript isrunning.vbs

Code: Select all

Function IsProcessRunning( strServer, strProcess )
    Dim Process, strObject
    IsProcessRunning = False
    strObject   = "winmgmts://" & strServer
    For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
	If UCase( Process.name ) = UCase( strProcess ) Then
            IsProcessRunning = True
            Exit Function
        End If
    Next
End Function

Dim strComputer, strProcess
If( IsProcessRunning( "YOURSYSTEMNAME", "eq2world.exe" ) = True ) Then

Else

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("YOURSTARTUPSCRIPTFULLPATH")

End If
Note be sure to change: YOURSYSTEMNAME to whatever your OS is named

Change your YOURSTARTUPSCRIPTFULLPATH to whatever matches your startup script or exe ie "c:\eq2emu\startup.bat"

I run this script every minute and if the server is down it runs my startup.bat file which restarts the services.