Page 1 of 1 1
Topic Options
#151562 - 2005-11-15 04:48 PM kIX Rookie
Breezer12763 Offline
Lurker

Registered: 2005-11-15
Posts: 3
I am new to KIX scripting, so please take it easy.

I do have a question though. I am trying to build a script that will call a batch script every 30 seconds or so. Can I use "srvany.exe" to run the srcipt as a service? Any script examples would be great.

Thanks David

Top
#151563 - 2005-11-15 04:53 PM Re: kIX Rookie
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you don't need kix if you want to run batch.

if you start using kix, you probably should import the batch into the script too.
_________________________
!

download KiXnet

Top
#151564 - 2005-11-15 06:46 PM Re: kIX Rookie
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Why not post what your batch does and perhaps we can advise a complete script update that will work better and you can then either schedule it or sleep it or whatever the case may be.
Top
#151565 - 2005-11-15 06:58 PM Re: kIX Rookie
Breezer12763 Offline
Lurker

Registered: 2005-11-15
Posts: 3
I am trying to get KIX to run in the back ground, (a timer if you will) and execute the following VB code every 45 seconds. This will be used to monitor a certain application that we are having issues with running. When the application dies, then it will send a smtp page to on-call engineers. I have very little experience with KIX and if I can incorporate both script's into one, that would be a bonus.

Thanks guys for your help

First KIX script;
:LOOP
SLEEP 10
Shell "C:\ProcessManager.vbs"
GOTO "LOOP"

Second VB script;

Dim strProcess

strProcess = ( "fcintsrv.exe" )

If( IsProcessRunning( strProcess ) = false ) Then
WScript.Echo "Process " & strProcess & " is not running on computer " & strComputer
End If

Function IsProcessRunning( 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

Set oShell = CreateObject("WScript.Shell")
oShell.Run "MAILSEND.EXE -s ""SoftWare Errors"" -to xxx@example.com -from ""@wksta@@example.com"" -msg ""FirstClass has experienced severe software issues. Please check immediatly"" -smtp smtp.server.com "

Top
#151566 - 2005-11-15 07:37 PM Re: kIX Rookie
vosal Offline
Fresh Scripter

Registered: 2005-11-15
Posts: 20
Maybe service keeper is the tool you are looking for.
It monitors services and you can configure activities on stoped services.
like try to start or send mails.
http://www.activeplus.com/us/products/skeeper/

Top
#151567 - 2005-11-15 07:53 PM Re: kIX Rookie
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The recovery tab on the service lets you perform several actions, one of which is to run a file.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#151568 - 2005-11-15 08:05 PM Re: kIX Rookie
Breezer12763 Offline
Lurker

Registered: 2005-11-15
Posts: 3
The issue is that the application does not run as a service in addition to my chain of command not budgeting any $ for additional monitoring software.

Thanks for the reply's though

Top
#151569 - 2005-11-15 08:26 PM Re: kIX Rookie
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, I combined your scripts into single kix script:
Code:

"press any key to end the script..."
do
if checkProcessRunning("fcintsrv.exe")
"yes, process is running..." ?
else
"nope, process is not running." ?
endif
for $sleeper = 1 to 45 ;sleeping 45 seconds
if kbhit()
$sleeper = 45
$keybhit = 1
sleep 1 ;sleeping 1 second, 45 times. this way script is more responsive to keyboard interrupt.
endif
next ; end of sleeper
until $keybhit


Function checkProcessRunning($strProcess)
Dim $Process
For Each $Process in GetObject( "winmgmts://." ).InstancesOf( "win32_process" )
If UCase( $Process.name ) = UCase( $strProcess )
$checkProcessRunning = 1
EndIf
Next
EndFunction



you didn't define the string server anywhere so I assumed it is "."
also, not sure did I miss something but the mailer seemed totally not related.
_________________________
!

download KiXnet

Top
#151570 - 2005-11-15 10:42 PM Re: kIX Rookie
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hmmmm...

Quote:


SK-002 ServiceKeeper (Up to 2 monitored servers) 199.00
SK-005 ServiceKeeper (Up to 5 monitored servers) 449.00
SK-010 ServiceKeeper (Up to 10 monitored servers) 849.00
SK-025 ServiceKeeper (Up to 25 monitored servers) 1,799.00
SK-SITE ServiceKeeper (Site, Unlimited) 3,499.00




 

KiX $0.00
 

Top
#151571 - 2005-11-16 01:19 AM Re: kIX Rookie
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Quote:


Hmmmm...


Quote:
--------------------------------------------------------------------------------


SK-002 ServiceKeeper (Up to 2 monitored servers) 199.00
SK-005 ServiceKeeper (Up to 5 monitored servers) 449.00
SK-010 ServiceKeeper (Up to 10 monitored servers) 849.00
SK-025 ServiceKeeper (Up to 25 monitored servers) 1,799.00
SK-SITE ServiceKeeper (Site, Unlimited) 3,499.00



--------------------------------------------------------------------------------




KiX $0.00






Quoting a famous series of commercials:
Priceless

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.07 seconds in which 0.033 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org