Author Topic: ServerCheck Autoit Script  (Read 1207 times)

Alf

I wasn't sure where to post this so I decided to post it in general.  I currently run a dedicated server and kept having my server crashing randomly every so often.  I have coded a quick autoit script that automatically starts the process for you.  If the process crashes it automatically reopens the server and starts it up again.  If you have any questions feel free to ask them here.  The script will need to be tweaked to work for your purposes.

Where to get AutoIt:
http://www.autoitscript.com/autoit3/

The Code:
Code: [Select]
#Watch Blockland Script
#var i should be the number of times you want the script to reopen the server
For $i = 3 to 1 Step -1
Send("#r")
WinWaitActive("Run")
Send("cmd{Enter}")
WinWaitActive("C:\WINDOWS\system32\cmd.exe")
Send("cd \{Enter}")
#should be equal to where your dedicated server is located, where you can find the Blockland.exe
Send("cd ""documents and settings\owner\desktop\blockland\""{Enter}")
#this is where you do your attributes for the blockland.exe run
Send("blockland.exe -dedicated -map bedroom{Enter}")
#waits for the process to start
ProcessWait("Blockland.exe")
#closes extra command prompt
WinClose("C:\WINDOWS\system32\cmd.exe")
#waits for the Blockland.exe to crash or be closed, than goes through loop again
ProcessWaitClose("Blockland.exe")
Next


It's not the nicest looking code, but it works for my purposes.  I thought I'd share it with the community
« Last Edit: August 15, 2008, 07:34:59 PM by Alf »

This may come in handy, but i rarely make dedicated servers, let alone normal servers :P

You should of zipp'ed up the program with this in it. Like a package.

I'll be using it, thanks.

Alf

You should of zipp'ed up the program with this in it. Like a package.

I'll be using it, thanks.

The code is very simple and I didn't feel like coding a configuration file.  That will come later on as I work to perfect the script.  My plans are to implement a log file and a configuration file at some point soon.

Either way I'm glade it will be of use to others.