SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Monitor service script

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Monitor service script
Author Message
Jack Dorson



Joined: 23 Aug 2006
Posts: 4

Post Monitor service script Reply with quote

Hi,
I got the following script from this website..however, it gives
me an error which says 'invalid exit statement'

===========
ServiceGetStatus "Application Management"
Dim status, string
Dim running
ServiceGetStatus "Application Management",status

IsEqual status, "RUNNING", running
IfThen running, DONE

IsEqual status,"START PENDING", running
IfThen running, DONE

START_SERVICE:
ServiceStart "Application Management"

ServiceGetStatus "Application Management", status

IsEqual status, "RUNNING", running
IfThen running,NOTIFY_OK,NOTIFY_FAIL

NOTIFY_OK:
MailSend "SMTPINT","smtpext@fulcrumconnections.biz", "24x7 Scheduler"
DONE:

NOTIFY_FAIL:
MailSend "SMTPINT","smtpext@fulcrumconnections.biz", "24x7 Scheduler"
DONE:

Exit

==================

why is it so? you may try at your end..

pls guide..

thanks in advance

Wed Aug 23, 2006 7:04 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7970

Post Re: Monitor service script Reply with quote

There are 2 issues:
1. ServiceGetStatus in the first line is invalid and not needed - just remove that line
2. ServiceGetStatus uses service names rather then service display names. "Application Management" happens to be display name that it will not be able to find. The real name is "AppMgmt" Therefore the third line should be changed to
ServiceGetStatus "AppMgmt",status

Similarly you need to change ServiceStart and ServiceGetStatus in other lines to refer to AppMgmt.

If you need to find out service name open services properties in the Computer Management / Services applet. This name is displayed in the first line in the Properties dialog above the modifiable display name field.

: Hi,
: I got the following script from this website..however, it gives
: me an error which says 'invalid exit statement'

: ===========
: ServiceGetStatus "Application Management"
: Dim status, string
: Dim running
: ServiceGetStatus "Application Management",status

: IsEqual status, "RUNNING", running
: IfThen running, DONE

: IsEqual status,"START PENDING", running
: IfThen running, DONE

: START_SERVICE: ServiceStart "Application Management"

: ServiceGetStatus "Application Management", status

: IsEqual status, "RUNNING", running
: IfThen running,NOTIFY_OK,NOTIFY_FAIL

: NOTIFY_OK: MailSend
: "SMTPINT","smtpext@fulcrumconnections.biz", "24x7
: Scheduler"
: DONE: NOTIFY_FAIL: MailSend
: "SMTPINT","smtpext@fulcrumconnections.biz", "24x7
: Scheduler"
: DONE: Exit

: ==================

: why is it so? you may try at your end..

: pls guide..

: thanks in advance

Wed Aug 23, 2006 7:45 am View user's profile Send private message
Jack Dorson



Joined: 23 Aug 2006
Posts: 4

Post Re: Monitor service script Reply with quote

thanks..
i did that & now give following error:
Type Mismatch:'servicegetstatus'

pls guide.

: There are 2 issues: 1. ServiceGetStatus in the first line is invalid and not
: needed - just remove that line
: 2. ServiceGetStatus uses service names rather then service display names.
: "Application Management" happens to be display name that it will
: not be able to find. The real name is "AppMgmt" Therefore the
: third line should be changed to
: ServiceGetStatus "AppMgmt",status

: Similarly you need to change ServiceStart and ServiceGetStatus in other lines
: to refer to AppMgmt.

: If you need to find out service name open services properties in the Computer
: Management / Services applet. This name is displayed in the first line in
: the Properties dialog above the modifiable display name field.

Wed Aug 23, 2006 9:17 am View user's profile Send private message
Jack Dorson



Joined: 23 Aug 2006
Posts: 4

Post Re: Monitor service script Reply with quote

: thanks..
: i did that & now give following error: Type Mismatch:'servicegetstatus'

: pls guide.

fyi..i am running the script from windows command prompt

Wed Aug 23, 2006 9:25 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7970

Post Re: Monitor service script Reply with quote

After looking at your script, I noticed several other issues, for example, in line 3 you declare "running" variable without specifying the datatype. It should be like this

Dim running, Boolean

Below is the corrected script

====================
Dim status, string
Dim running, boolean

// get service status
ServiceGetStatus "AppMgmt",status

// if running or starting, we have nothing to do
IsEqual status, "RUNNING", running
IfThen running, DONE
IsEqual status,"START PENDING", running
IfThen running, DONE

// start service
ServiceStart "AppMgmt"

// verify service started
Wait 10
ServiceGetStatus "AppMgmt", status

// if running, send success notification, otherwise send error notification
IsEqual status, "RUNNING", running
IfThen running, NOTIFY_OK, NOTIFY_FAIL

NOTIFY_OK:
MailSend "SMTPINT", "smtpext@fulcrumconnections.biz", "", "24x7 Scheduler", "Service Application Management has been started"
Exit

NOTIFY_FAIL:
MailSend "SMTPINT","smtpext@fulcrumconnections.biz", "", "24x7 Scheduler", "Unable to start Application Management service"

DONE:
====================

By the way, the same task could be accomplished much easier in the 24x7 Event Server.

: thanks..
: i did that & now give following error: Type Mismatch:'servicegetstatus'

: pls guide.

Wed Aug 23, 2006 9:39 am View user's profile Send private message
Jack Dorson



Joined: 23 Aug 2006
Posts: 4

Post Re: Monitor service script Reply with quote

thanks again..
i copied the same script that you gave..
now it gives error "expected identifier" on line 2
*Dim running, boolean *

any clues?

: After looking at your script, I noticed several other issues, for example, in
: line 3 you declare "running" variable without specifying the
: datatype. It should be like this

: Dim running, Boolean

: Below is the corrected script

: ====================
: Dim status, string
: Dim running, boolean

: // get service status
: ServiceGetStatus "AppMgmt",status

: // if running or starting, we have nothing to do
: IsEqual status, "RUNNING", running
: IfThen running, DONE
: IsEqual status,"START PENDING", running
: IfThen running, DONE

: // start service
: ServiceStart "AppMgmt"

: // verify service started
: Wait 10
: ServiceGetStatus "AppMgmt", status

: // if running, send success notification, otherwise send error notification
: IsEqual status, "RUNNING", running
: IfThen running, NOTIFY_OK, NOTIFY_FAIL

: NOTIFY_OK: MailSend "SMTPINT",
: "smtpext@fulcrumconnections.biz", "", "24x7
: Scheduler", "Service Application Management has been
: started"
: Exit

: NOTIFY_FAIL: MailSend
: "SMTPINT","smtpext@fulcrumconnections.biz",
: "", "24x7 Scheduler", "Unable to start
: Application Management service"

: DONE: ====================

: By the way, the same task could be accomplished much easier in the 24x7 Event
: Server.

Wed Aug 23, 2006 10:17 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7970

Post Re: Monitor service script Reply with quote

Where and how are you running it?

Are yo uaware that this script is for 24x7 Scheduler's JAL job engine?

: thanks again..
: i copied the same script that you gave..
: now it gives error "expected identifier" on line 2
: *Dim running, boolean *

: any clues?

Wed Aug 23, 2006 12:42 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.