Newbe email notification question

Advertisement

torentine
Joined:
Posts:
2
Location:
Monterey California

Newbe email notification question

First of all congratulation on a great product.

Now moving on, I have a folder on my network on which users store lab results. I created a scheduled task which call on WINSCP to automatically upload any new files to remote FTP server and then it moves those files to a different directoy on the local server. All this is working just fine.

The problem is that I also configured email notification for when the job fails. The email portion works a little to well. The problem is that when there are no files to be transfered I get an email with an error notification.

This is what I have as a script which get called on by a batch file.

option batch on
option confirm off
open labresults
put *.*
exit

Please Help

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,209
Location:
Prague, Czechia

Re: Newbe email notification question

OK, but what about the code that sends the email?
_________________
Martin Prikryl

Reply with quote

Guest

oh ok after the script runs it calls on a bat file with the following code:

winscp.com /script=MoveLabResults.txt
if errorlevel 1 goto error

echo Upload succeeded, moving local files
move C:\cssw\hl7\emd\Results\*.* c:\backup\

:error
echo Error!
bmail.exe -s 192.168.16.10 -t user@example.com -f Results@example.com -b "FTP File Transfer Failed To SVMH" -a "PCM LabLab Results Transfer Failure"


:end

Reply with quote

torentine
Joined:
Posts:
2
Location:
Monterey California

I just wish that I wouldnt get a failed email after the job tries to run and there are no files in the directory.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,209
Location:
Prague, Czechia

Your batch file misses goto end command after move command, so you get the email even on success.
_________________
Martin Prikryl

Reply with quote

lyf
Guest

martin wrote:

Your batch file misses goto end command after move command, so you get the email even on success.

I think when WinSCP finds there are no files to upload, it sees this as an error but it is actually perfectly fine since not everytime there will be files to send. So how are we going to differentiate this error from the real problems?

cheers
lyf

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,209
Location:
Prague, Czechia

lyf wrote:

I think when WinSCP finds there are no files to upload, it sees this as an error but it is actually perfectly fine since not everytime there will be files to send. So how are we going to differentiate this error from the real problems?
This is not true.
Your batch file is simply wrong, as I have suggested in my previous post.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum