@echo offThe echo for 'Memory Usage Warning' will only execute if the memory usage exceeds 1400 (in this example) This could be a call, note the use of subroutines in the batch file (CHECKMU). If there are many processes running the PID could be passed using other variables (%%a, %%b, etc.) but it will execute for each instance that meets the criteria.
for /F "usebackq tokens=1,2,3,4,5,6 delims=, " %%a IN (`tasklist /NH /FI "imagename eq putty.exe"`) do CALL :CHECKMU %%e%%f
goto :eof
:CHECKMU
SET /A MEMUSAGE=0+%~1
IF /I %MEMUSAGE% GTR 1400 echo Memory Usage Warning: %MEMUSAGE%
GOTO :eof
I'm no guru, but I hope that what I find useful will help someone else. Enjoy.
Friday, May 04, 2007
Alerting when a process is a memory pig...
Now this example uses putty.exe right now, but the original purpose was to alert when a jrun.exe was getting too big for it's britches. Run as a scheduled task (AT job) and customize to suit:
Subscribe to:
Post Comments (Atom)
There is no individual ownership when you are part of a team, it's the sum of the parts that makes you the RESILIENT team you need to be...
-
You can eliminate the use of this middle-man tool by creating Desktop or Quick Launch toolbar shortcuts to the actual program easily, but it...
-
It is critical to ensure data integrity in todays business world. Loss of data can set you back days or weeks and may put you in hot water w...
-
So, a recent project I worked on... So recent as in, MANY MONTHS AGO. So I worked on this script to assist with an installation process a...
1 comment:
Thank you Cameron, It works perfectly fine.
Post a Comment