Jump to content

Script to monitor script


 Share

Recommended Posts

Hello,

I'm new to AutoIt so please be kind to me:-)

Here's my situation. I want to create a script to monitor another script. When the being monitored script fail or abort for whatever reason, I want the monitor script to logged or captured those errors or termination activities into a file for later analysis.

Thanks in advance.

Yog

Link to comment
Share on other sites

Hello,

I'm new to AutoIt so please be kind to me:-)

Here's my situation. I want to create a script to monitor another script. When the being monitored script fail or abort for whatever reason, I want the monitor script to logged or captured those errors or termination activities into a file for later analysis.

Thanks in advance.

Yog

while 1

if not processexists("Program name") then

shellexecute("Process")

filewrite("File.txt","Program stopped didnt exist at: " & @Day & @Month & @year & " the time was: " & @hour & @min)

sleep(100)

wend

Edited by ReaImDown
[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

Thanks ReaImDown for the quick reply. I can see your logic, but what I need in addition to what you pointed out is information like what line is the being monitored script abort and/or maybe for what reason, that kind of information.

Thanks,

Yog

Link to comment
Share on other sites

Thanks ReaImDown for the quick reply. I can see your logic, but what I need in addition to what you pointed out is information like what line is the being monitored script abort and/or maybe for what reason, that kind of information.

Thanks,

Yog

as far as I know... if your script fails or exits for any reason, the other program will have absolutely no way to see why it exited.

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

In AutoIt, can you run it in debugging mode and then capture the error(s) output? Like I said, I'm new here so I'm probably asking question that might not make sense or impossible to do with AutoIt.

Thanks,

Yog.

Link to comment
Share on other sites

In AutoIt, can you run it in debugging mode and then capture the error(s) output? Like I said, I'm new here so I'm probably asking question that might not make sense or impossible to do with AutoIt.

Thanks,

Yog.

what is the script that your trying to monitor exactly? I can help you with it if you wish.

[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Link to comment
Share on other sites

Thanks for the offering. What I'm trying to do is I would like to write some testing scripts for our testing team. Have this one script run and monitor the other testing scripts and if anyone of those fail, log the failed activities if possible. Can it be done?

Thanks,

Yog.

Link to comment
Share on other sites

Thanks for the offering. What I'm trying to do is I would like to write some testing scripts for our testing team. Have this one script run and monitor the other testing scripts and if anyone of those fail, log the failed activities if possible. Can it be done?

Thanks,

Yog.

Link to comment
Share on other sites

To run a script in Debug mode, add this line at the top of your script:

#AutoIt3Wrapper_run_debug_mode=Y

-edit-

You need to run your script from SciTe to see the script information.

-------

And perhaps you were looking for something like this:

http://www.autoitscript.com/forum/index.php?showtopic=53023

Edited by Nahuel
Link to comment
Share on other sites

... I want to create a script to monitor another script. ...

Welcome to the forum.

When you say, "Have this one script run and monitor the other testing scripts and if anyone of those fail, log the failed activities if possible." What are you expecting to fail - the AutoIt script or the software/hardware being tested by these "testing scripts"?

A rewording of what you said:

... information like what line the script being monitored is on when it aborted and/or maybe for what reason ...

An AutoIt script should never crash/abort - it should only end/exit.

You can assign as much info to as many variables as you wish (within the technical limits) - then change that info at major points throughout your "testing scripts". When the "testing script" exits, it can write that info to a file for you to read later. You might glance in the AutoIt help file at the function named OnAutoItExit(). It should allow you to write your desired info as the script's ends/exits.

If the goal of your monitoring script is to make an aggregate presentation (or "almost real time" monitoring) of the failure logs of these "testing scripts" - then that should not be hard to code.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...