VisualCron
»
Support
»
API
»
Set status as failed for task
 Rank: Newbie
Joined: 2/8/2011(UTC) Posts: 4 Location: Brantford
|
We are currently running several script (windows host/script files) through VisualCron. When an error happens in the script file we want to communicate back to VisualCron that the task has failed and specify the error message. How can we accomplish this?
|
|
|
|
|
|
 Rank: Administration
Joined: 2/23/2008(UTC) Posts: 6,165  Location: Sweden Thanks: 200 times Was thanked: 120 time(s) in 115 post(s)
|
What kind of scripting language? VBScript? Bat files? |
|
|
|
|
|
|
 Rank: Newbie
Joined: 2/8/2011(UTC) Posts: 4 Location: Brantford
|
We are using VBScript files.
|
|
|
|
|
|
 Rank: Administration
Joined: 2/23/2008(UTC) Posts: 6,165  Location: Sweden Thanks: 200 times Was thanked: 120 time(s) in 115 post(s)
|
You could use: wscript.quit(1) You can probably also use: Err.Raise 1 http://stackoverflow.com...row-an-error-in-vbscriptReplace 1 with any exit code. VisualCron captures the exit code. Any other exit code than 0 is a failure. VisualCron uses standard Windows exit code descriptions located in an xml file called ExitCodes.xml. But you could print any info to standard out or standard error using: WScript.StdOut.Write("Output text") WScript.StdErr.Write("Error text") |
|
|
|
|
|
|
 Rank: Newbie
Joined: 2/8/2011(UTC) Posts: 4 Location: Brantford
|
VisualCron doesn't seem to capture error when I execute:
WScript.StdErr.Write("custom error message")
Use exit codes is not an option as we want to log specific custom error messages about the details of the error and not predefined errors. Is there no way to set the task status to failed and add a reason through the API?
|
|
|
|
|
|
 Rank: Advanced Member
Joined: 5/21/2010(UTC) Posts: 61
Was thanked: 2 time(s) in 2 post(s)
|
You can do... WScript.StdErr.Write("custom error message") wscript.quit(1) Then the 'Result' will say "Failed", 'Output' or 'Output (stderr)' will show your error description (you can double click if it's more than one line). 'Result' will have the predefined error. You can live with it :) or probably create additional lines in the xml file that has all the standard error messages defined. Start from 20000. I think VisualCron uses the xml file to get its descriptions but then you run the risk that this file may be overridden with new releases. LEikelman wrote:VisualCron doesn't seem to capture error when I execute:
WScript.StdErr.Write("custom error message")
Use exit codes is not an option as we want to log specific custom error messages about the details of the error and not predefined errors. Is there no way to set the task status to failed and add a reason through the API? Edited by user Thursday, March 03, 2011 10:29:32 PM(UTC)
| Reason: Not specified
|
|
|
|
|
|
 Rank: Newbie
Joined: 2/8/2011(UTC) Posts: 4 Location: Brantford
|
I can see the custom message in the result column, but if the job runs again it overwrites the result message. Using the "Retrieve Log" function in VisualCron doesn't display the custom error message. Where would I go to retrieve the logged custom error messages in stderr?
|
|
|
|
|
|
 Rank: Administration
Joined: 2/23/2008(UTC) Posts: 6,165  Location: Sweden Thanks: 200 times Was thanked: 120 time(s) in 115 post(s)
|
One way is to write the output to file or send an email after each run. But we are also developing a historic tool for output which hopefully will be ready soon. LEikelman wrote:I can see the custom message in the result column, but if the job runs again it overwrites the result message. Using the "Retrieve Log" function in VisualCron doesn't display the custom error message. Where would I go to retrieve the logged custom error messages in stderr?
|
|
|
|
|
|
|
| Users browsing this topic |
|
Guest
|
VisualCron
»
Support
»
API
»
Set status as failed for task
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.