Revisiting this today I discovered (by adding a pause in my script) the issue 
was that Servers alive was not accessing the path to the file as I thought and 
instead was setting the exit code to a non-numeric value. This was interpreted 
by Salive as a 0.   I used the full path in that place in my batch and it is 
working now. Thank you everyone for your help.  

Jason Passow Network Administrator 
http://www.mwsco.com 
jas...@mwsco.com 
ph: (507) 494-5178 
fax: (507) 454-8104








Mississippi Welder Supply Co., Inc.  




Please consider the environment before printing this email.

____________________________________________________________________________________________________________________________________________________________________________________________________________________________

The information contained in this message is privileged and intended only for 
the recipients named. If the reader is not a representative of the intended 
recipient, any review, dissemination or copying of this message or the 
information it contains is prohibited. If you have received this message in 
error, please immediately notify the sender, and delete the original message 
and attachments.


From: "Demeulemeester, Pieter" <pieter.demeulemees...@fracarita.org> 
To: Servers Alive Discussion List <salive@woodstone.nu> 
Sent: 12/10/2015 2:35 AM 
Subject: RE: [SA-list] ErrorLevel AGAIN 

 

Hi, 

 

I use the “External (errorlevel)” check with success.  If fact, it’s one 
of my favorite checks because it allows to check “everything I want, as far 
as I can do a command line check”. 

I use it with CMD-files and PS1-files.  Not with BAT-files, but in most cases 
you can just rename the BAT into a CMD file. 

 

I have 2 dummy batches (CMD and PS1) which I use to troubleshoot the check in 
SA : 

1. AlwaysError5.cmd 

exit /B 5 

 

2. AlwaysError5.ps1 

exit 5 

 

My config: 

·        SA version 7.2.2628 

·        Win2012 

·        External (errorlevel) check, Alarm when MyBatchFile.cmd is <> from 0, 
Kill the external application when not stopped in time=ON, Timeout=5 sec. 

 

Kind regards, 

Pieter 

 

 

From: Servers Alive Discussion List [mailto:salive@woodstone.nu] On Behalf Of 
dirk
Sent: woensdag 9 december 2015 20:31
To: Servers Alive Discussion List
Subject: RE: [SA-list] ErrorLevel AGAIN 

 

I think the answer is simple. Servers Alive can capture the ERRORLEVEL set by 
the application that is actualy executed.  And to execute a .BAT file the OS 
will (behind the scene) launch the command interpreter and this command 
interpreter will execute your BAT file.  The errorlevel we get back in Servers 
Alive is the one that is set by the command interpreter, not the one by the 
.BAT file executed within the command interpreter. 

 

If you start a command prompt and then the .BAT file, the OS can directly 
execute the .BAT without having to start another command interpreter. And then 
it's possible to see the actual errorlevel that is returned by the .BAT file. 

 

I personaly don't see a way to get the errorlevel back into SA when the OS is 
not returning it via the command interpreter back to the actual caller (SA). 

 


So the answer is (I think) it's not possible with a .BAT file. 

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



From: Servers Alive Discussion List [mailto:salive@woodstone.nu 
(mailto:salive@woodstone.nu)] On Behalf Of Jason Passow
Sent: Wednesday, December 09, 2015 6:15 PM
To: Servers Alive Discussion List
Subject: Re: [SA-list] ErrorLevel AGAIN 

Full path to the .bat file.   C:\Program Files (x86)\CountError\CountError.bat  
no quotes or extra characters.  The batch file is running because it writes 
results to a file (output.txt).  That file is changing but the errorlevel is 
returned as 0 every time.   

Jason Passow  

Network Administrator 


http://www.mwsco.com (http://www.mwsco.com) 


jas...@mwsco.com (mailto:jas...@mwsco.com) 


ph: (507) 494-5178 


fax: (507) 454-8104 


 





 

Mississippi Welder Supply Co., Inc.  





Please consider the environment before printing this email. 

____________________________________________________________________________________________________________________________________________________________________________________________________________________________
 

The information contained in this message is privileged and intended only for 
the recipients named. If the reader is not a representative of the intended 
recipient, any review, dissemination or copying of this message or the 
information it contains is prohibited. If you have received this message in 
error, please immediately notify the sender, and delete the original message 
and attachments. 





From: dirk <d...@woodstone.nu (mailto:d...@woodstone.nu)> 
To: Servers Alive Discussion List <salive@woodstone.nu 
(mailto:salive@woodstone.nu)> 
Sent: 12/9/2015 10:55 AM 
Subject: RE: [SA-list] ErrorLevel AGAIN 

 

How are you calling the bat file in Servers Alive? 

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



From: Servers Alive Discussion List [mailto:salive@woodstone.nu 
(mailto:salive@woodstone.nu)] On Behalf Of Jason Passow
Sent: Wednesday, December 09, 2015 5:35 PM
To: Servers Alive Discussion List
Subject: Re: [SA-list] ErrorLevel AGAIN 

Mine returns in less than 3 seconds.  I have changed the timeout to 30 with the 
same result.   

Jason Passow  

Network Administrator 


http://www.mwsco.com (http://www.mwsco.com) 


jas...@mwsco.com (mailto:jas...@mwsco.com) 


ph: (507) 494-5178 


fax: (507) 454-8104 


 





 

Mississippi Welder Supply Co., Inc.  





Please consider the environment before printing this email. 

____________________________________________________________________________________________________________________________________________________________________________________________________________________________
 

The information contained in this message is privileged and intended only for 
the recipients named. If the reader is not a representative of the intended 
recipient, any review, dissemination or copying of this message or the 
information it contains is prohibited. If you have received this message in 
error, please immediately notify the sender, and delete the original message 
and attachments. 





From: Roderick Garcia <roderick.gar...@cancer.org 
(mailto:roderick.gar...@cancer.org)> 
To: Servers Alive Discussion List <salive@woodstone.nu 
(mailto:salive@woodstone.nu)> 
Sent: 12/9/2015 10:20 AM 
Subject: RE: [SA-list] ErrorLevel AGAIN 

I had a similar issue and mine turned out to be the timeout setting with was at 
the default 5.  I wasn’t allocating enough time for the check 
to complete.  Thus a false return. 

 

 

Roderick Garcia | Senior Systems Support Engineer 

American Cancer Society, Inc. 

8400 Silver Crossing 

Oklahoma City, OK 73132 

cancer.org (http://www.cancer.org) | 1.800.227.2345 

 (http://www.facebook.com/americancancersociety?societysignature=facebook)  
(http://www.twitter.com/americancancer?societysignature=twitter)  
(http://www.youtube.com/user/AmerCancerSociety?societysignature=youtube)  
(http://www.linkedin.com/company/american-cancer-society?societysignature=linkedin)
 

 (http://www.cancer.org/)            
(http://charityreports.bbb.org/public/seal.aspx?ID=1413312005) 


This message (including any attachments) is intended exclusively for the 
individual to whom it is addressed and may contain proprietary, protected, or 
confidential information. If you are not the named addressee, you are not 
authorized to read, print, copy, or disseminate this message or any part of it. 
If you have received this message in error, please notify the sender 
immediately. 

From: Servers Alive Discussion List [mailto:salive@woodstone.nu 
(mailto:salive@woodstone.nu)] On Behalf Of Jason Passow
Sent: Wednesday, December 09, 2015 9:50 AM
To: Servers Alive Discussion List
Subject: [SA-list] ErrorLevel AGAIN 

 

I have a check which always returns error level 0.  It should  not and from a 
command line it indeed does not.  Using the Checkerrorlevel that comes with 
salive it does indeed show 0.  

 


 


 Output .txt  contains 2 


 


for /F "delims=" %%a in (output.txt) do ( 


   set "SHELL_EXIT_CODE=%%a" 


) 


 


exit  %SHELL_EXIT_CODE% 


 


Command line results: 


C:\Program Files (x86)\CountError\>CountError.bat 


 


C:\Program Files (x86)\CountError\>echo %errorlevel% 


2 


 


 



Jason Passow 

Network Administrator 


http://www.mwsco.com (http://www.mwsco.com) 


jas...@mwsco.com (mailto:jas...@mwsco.com) 


ph: (507) 494-5178 


fax: (507) 454-8104 


 





 

Mississippi Welder Supply Co., Inc.  

 

Please consider the environment before printing this email. 

____________________________________________________________________________________________________________________________________________________________________________________________________________________________
 

The information contained in this message is privileged and intended only for 
the recipients named. If the reader is not a representative of the intended 
recipient, any review, dissemination or copying of this message or the 
information it contains is prohibited. If you have received this message in 
error, please immediately notify the sender, and delete the original message 
and attachments. 



To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu (mailto:salive@woodstone.nu)
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list. 



To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu (mailto:salive@woodstone.nu)
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list. 

 



To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu (mailto:salive@woodstone.nu)
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list. 

No virus found in this message.
Checked by AVG - www.avg.com (http://www.avg.com)
Version: 2016.0.7294 / Virus Database: 4483/11146 - Release Date: 12/09/15 



To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu (mailto:salive@woodstone.nu)
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list. 

 



To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu (mailto:salive@woodstone.nu)
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list. 

No virus found in this message.
Checked by AVG - www.avg.com (http://www.avg.com)
Version: 2016.0.7294 / Virus Database: 4483/11146 - Release Date: 12/09/15 



To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu (mailto:salive@woodstone.nu)
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list. 

To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list. 



To unsubscribe send a message with UNSUBSCRIBE in the subject line to 
salive@woodstone.nu
If you use auto-responders (like out-of-the-office messages), make sure that 
they are not sent to the list nor to individual members. Doing so will cause 
you to be automatically removed from the list.

Reply via email to