Sorry for placing this here, but i know that this is one of the most suitables
places to find real gurus and not only for ARS :-);
I'm facing an error that it seems to be a logic error (from myself) or lack of
knowledge in regards Batch scripting (I've always been Unix guy), so hope
someone could give me some light on this.
I'm setting a monitor (not exactly, because is reactive) process on a VM -
Win2003 pro, for corrective purposes of Tomcat process, itself only monitors
the established connnections within server and users, and if it finds more than
80 established connections, will store that first violation, and wait for
certain time to run again, if it finds more than 80 connections 3 consecutive
times, then will stop Tomcat Server and start up again the processes.
So far I've the structure of the code but I'm finding a couple of issues that
kept me hitting my head against the keyboard.
1.- In the monitor log, If I found more than 80 open connections at that time I
send an ECHO 1 >>"C:\Somedirectory\Sompepath\openconnections.log", but when I
check the log file found that it writes "1 " (the 1 and a blank space after and
a return); is there a way to only write the file with a flat '1' with no extra
characters?
2.- Once the file is created the program will read the information and assign
that to a variable:
SET /P mycounter =<"C:\Somedirectory\Sompepath\openconnections.log"
I placed a ECHO output for that and I'm seeing that is getting the information
as expected "1 ", and then
3.- I peform the validation against my flag to stop tomcat servies
IF [%mycounter%] EQU [%maxtries%] CALL rebootscript.bat
However, the validation is always true, an ECHO output for this last code line
showed me [1 ] EQU [111]; my understanding is that I'm doing a string to string
comparisson, but i can't figure out why DOS is assuming that 1 is the same as
111 not the same string lenght, neither value..., I'm pretty sure I'm missing
something here, but can't figure out what is that small piece I'm doing wrong.
Cheers.
Hugo Ruesga
Software Development Advisor
MX +52 (55) 4353.9802
P Please consider the environment before printing this email
The information contained in and transferred with this electronic message is
intended only for the recipient(s) designated above, it is protected by law and
it may contain information which is privileged and confidential. If you are not
the intended recipient, please do not read, copy, or use it, and do not
disclose it to others. Please notify the sender of the delivery error by
replying to this message, and then delete it from your system. Thank you.
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"