Page 1 of 1
Find files 15 min old in a dir and send mail
Posted: 13 May 2010 10:35
by redro
Hi All,
I am planning to implement batch script for if any file is sating from 15 min then i need to soot an email. Please suggest me on this.
Thanks,
JP.
Re: Find files 15 min old in a dir and send mail
Posted: 13 May 2010 10:56
by jeb
Hi redro,
first you have to solve the "mail to" problem
your own code
@echo off & setlocal
:: set the temp file location
set tempmail=%temp%\tempmail.%random%.txt
:: echo the basic headers to the temp file
echo To: "Scripting Test" ^<praveen.pullela@sirvisetti.com^>, ^<prakash.redrouthu@sirvisetti.com^> > %tempmail%
echo From: "Me" ^<support@sirvisetti.com^> >> %tempmail%
echo Subject: CVG ESB Process DOWN >> %tempmail%
:: echo the blank line that separates the header from the body text
echo.>>%tempmail%
:: echo the body text to the temp file
echo ESB DOWN ON 9099 port PLS check>> %tempmail%
echo GOOD DAY.>> %tempmail%
:: move the temp file to the mail pickup directory
:: adjust this location for your system
move %tempmail% c:\inetpub\mailroot\pickup
set tempmail=
endlocal
How to handle this, depends extremly on your mail mechanism.
It could be easier to use a tool like BLAT.exe, we use it for automaticaly publish new versions of our software
and call it like
Code: Select all
blat -q -subject "%subject%" -f %MAILFROM% -to %MAILTO% -server %MAILHOST% -u %MAILUSERNAME% -pw %MAILPASSWORD% -bodyF %SOURCE%
Second:
You have to solve your problem to find the 15min files, but you should read "Batch ffmpeg auto convert"
http://www.dostips.com/forum/viewtopic.php?f=3&t=1020It handles nearly the same problem.
jeb
Re: Find files 15 min old in a dir and send mail
Posted: 14 May 2010 06:13
by redro
Hi Jeb,
I have just added call.sendmail.bat in else condition and succeed in sending mail. Thanks for your assistence.
Thanks,
JP
Re: Find files 15 min old in a dir and send mail
Posted: 18 May 2010 06:07
by redro
HI Jeb,
I have successfully sending mail from XP environment but i am unable to send from Win 2003 with my above script. Any idea on it.
Thanks,
JP.
Re: Find files 15 min old in a dir and send mail
Posted: 20 May 2010 12:04
by jeb
Hi,
I suppose the sendmail fails, but better you post the output here.
jeb