Urban Terror Forums: "check if up" script - Urban Terror Forums

Jump to content

 Login | Register 
Advertisement
Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

"check if up" script Rate Topic: -----

#1 User is offline   H3NRY Icon

  • Account: h3nry
  • Main tag: .um
  • Country:
  • Joined: 28-February 10
  • Posts: 2,787

Posted 03 July 2012 - 04:12 PM

i was trying to find a better way to check if all my servers were up and figured a little VB would do the trick... yup.

here is the script if anyone wants... could be used to do a lot if edited a little ( to check if, and restart if not, a server is up for example.. will be doing this sometime my self)


set service = GetObject ("winmgmts:")
kfservers = "0"
mcservers = "0"
cod4servers = "0"
armaservers = "0"
UrTservers = "0"
	for each Process in Service.InstancesOf ("Win32_Process")
		If Process.Name = "ucc.exe" then
		kfservers = kfservers + 1
		End If
next
	for each Process in Service.InstancesOf ("Win32_Process")
		If Process.Name = "java.exe" OR Process.Name = "javaw.exe" then
		mcservers = mcservers + 1
		End If
		
next	
	for each Process in Service.InstancesOf ("Win32_Process")
		If Process.Name = "iw3mp.exe" then
		cod4servers = cod4servers + 1
		End If
		
next	
	for each Process in Service.InstancesOf ("Win32_Process")
		If Process.Name = "arma2oaserver.exe" then
		armaservers = armaservers + 1
		End If
		
next	
	for each Process in Service.InstancesOf ("Win32_Process")
		If Process.Name = "ioUrTded.exe" then
		UrTservers = UrTservers + 1
		End If
next
strMessage = "there are " & kfservers & " kfservers running. "
Wscript.Echo strMessage
strMessage = "there are " & mcservers & " mcservers running. "
Wscript.Echo strMessage
strMessage = "there are " & cod4servers & " cod4servers running. "
Wscript.Echo strMessage
strMessage = "there are " & armaservers & " armaservers running. "
Wscript.Echo strMessage
strMessage = "there are " & UrTservers & " UrTservers running. "
Wscript.Echo strMessage





you could add somethign like...

if cod4servers <= 5 then
exec "a:\server\file\location\iw3mp.exe -set net_port'1024' asdlkajsdlkajsd"





oh and beena while guys... how are people?

This post has been edited by H3NRY: 03 July 2012 - 04:16 PM

Urban Mulchers, .um, H3NRY.um
Hacker?, GTFO! we don't care who you are if you hack.

sadly no servers at the moment

#2 User is offline   Rylius Icon

  • Account: rylius
  • Main tag: CMM|
  • Country:
  • Joined: 28-February 10
  • Posts: 446

Posted 03 July 2012 - 04:29 PM

…why are you running the foreach loop for every different server type?
Just put all if clauses in one loop, jeez.

And you should check the launch parameters of the Minecraft process, it is reporting false data right now.

#3 User is offline   H3NRY Icon

  • Account: h3nry
  • Main tag: .um
  • Country:
  • Joined: 28-February 10
  • Posts: 2,787

Posted 03 July 2012 - 09:34 PM

View PostRylius, on 03 July 2012 - 04:29 PM, said:

…why are you running the foreach loop for every different server type?
Just put all if clauses in one loop, jeez.

And you should check the launch parameters of the Minecraft process, it is reporting false data right now.

yes i know about the minecraft but the only thing that will invoke java is the updater, which is disabled.

lol.. it wasnt streamlined... it took 5 minutes. oh and putting it all in clauses would pop up a message for each server type still?

plus come on, its a home server that has 20 people on it max when the Killing floor servers are not up ( when they are there are 35)
Urban Mulchers, .um, H3NRY.um
Hacker?, GTFO! we don't care who you are if you hack.

sadly no servers at the moment

#4 User is offline   Rylius Icon

  • Account: rylius
  • Main tag: CMM|
  • Country:
  • Joined: 28-February 10
  • Posts: 446

Posted 03 July 2012 - 09:40 PM

What I'm saying is do that:

for each Process in Service.InstancesOf ("Win32_Process")
                If Process.Name = "ucc.exe" then
                kfservers = kfservers + 1
                End If
                If Process.Name = "java.exe" OR Process.Name = "javaw.exe" then
                mcservers = mcservers + 1
                End If
                If Process.Name = "iw3mp.exe" then
                cod4servers = cod4servers + 1
                End If
                If Process.Name = "arma2oaserver.exe" then
                armaservers = armaservers + 1
                End If
                If Process.Name = "ioUrTded.exe" then
                UrTservers = UrTservers + 1
                End If
next



Saves tons of unnecessary iterations.
(Not sure if that is even correct, I never used VB (and I'm sure as hell not going to), if not, take it as pseudo-code. Also, add 'else' of course. And consider using += 1 or ++, if VB supports that)

This post has been edited by Rylius: 03 July 2012 - 09:41 PM


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

Advertisement


Copyright © 1999-2024 Frozensand Games Limited  |  All rights reserved  |  Urban Terror™ and FrozenSand™ are trademarks of Frozensand Games Limited

Frozensand Games is a Limited company registered in England and Wales. Company Reg No: 10343942