Find files 15 min old in a dir and send mail

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
redro
Posts: 11
Joined: 12 May 2010 05:24

Find files 15 min old in a dir and send mail

#1 Post by redro » 13 May 2010 10:35

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.

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: Find files 15 min old in a dir and send mail

#2 Post by jeb » 13 May 2010 10:56

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=1020
It handles nearly the same problem.

jeb

redro
Posts: 11
Joined: 12 May 2010 05:24

Re: Find files 15 min old in a dir and send mail

#3 Post by redro » 14 May 2010 06:13

Hi Jeb,

I have just added call.sendmail.bat in else condition and succeed in sending mail. Thanks for your assistence.

Thanks,
JP

redro
Posts: 11
Joined: 12 May 2010 05:24

Re: Find files 15 min old in a dir and send mail

#4 Post by redro » 18 May 2010 06:07

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.

jeb
Expert
Posts: 1055
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: Find files 15 min old in a dir and send mail

#5 Post by jeb » 20 May 2010 12:04

Hi,

I suppose the sendmail fails, but better you post the output here.

jeb

Post Reply