File: D:/bin/webbackup/sendemail.cmd
itpSendEmail low surinder@itpartnership.com webbackup@itpartnership.com "Web Backup Results" logtoday.txt
rem check for success
rem check if certain phrases exist, error if they do
find /i "426 Connection closed; transfer aborted." logtoday.txt
if ERRORLEVEL 1 goto ok1
goto error1
:ok1
find /i "451 Failure writing to local file." logtoday.txt
if ERRORLEVEL 1 goto ok2
goto error1
:ok2
find /i "553 Could not create file." logtoday.txt
if ERRORLEVEL 1 goto ok3
goto error1
:ok3
rem (SS,27/11/09) added following 2 checks
find /i "Not connected." logtoday.txt
if ERRORLEVEL 1 goto ok4
goto error1
:ok4
find /i "Invalid command." logtoday.txt
if ERRORLEVEL 1 goto ok5
goto error1
:ok5
rem check if certain phrases don't exist, error if they don't
rem (SS,29/4/12) replaced "230 User backup logged in." with "230 Logged on" for FileZilla
:: (SS,6/7/12) change for winscp to "Connected with ftp.ontheworldweb.com:5821."
:: (SS,13/7/12) changed ftp.ontheworldweb.com to secure.ontheworldweb.com
:: (SS,25/6/14) removed following two lines, now using sftp
::find /i "Connected with secure.ontheworldweb.com:5821" logtoday.txt
::if ERRORLEVEL 1 goto error1
:: (SS,6/7/12) changed from "230 Login successful." to "Active session: [1] backup@ftp.ontheworldweb.com" for winscp
:: (SS,13/7/12) changed ftp.ontheworldweb.com to secure.ontheworldweb.com
:: (SS,25/6/14) backup@secure.ontheworldweb.com to webbackup@secure.ontheworldweb.com
:: (SS,13/8/18) modified webbackup@secure.ontheworldweb.com to webbackup@hyperoptic.ontheworldweb.com
:: (SS,14/1/19) replaced hyperoptic with %1 (parameter passed to this routine)
find /i "Active session: [1] webbackup@%1.ontheworldweb.com" logtoday.txt
if ERRORLEVEL 1 goto error1
:: (SS,4/9/13) added following for new ftp
:: (SS,8/6/19) removed following two lines , old backup server no longer used
::find /i "Active session: [1] backup@backup.itpartnership.com" logtoday.txt
::if ERRORLEVEL 1 goto error1
rem find /i "226 File receive OK." logtoday.txt
rem find /i "226 Transfer complete." logtoday.txt
rem (SS,4/3/11) replaced above with following because 1and1 FTP server now returns "226 Transfer complete.", used to be "226 File received OK." Microsoft FTP servers always return "226 Transfer complete."
rem following returns "---------- LOGTODAY.TXT: 3" or "---------- LOGTODAY.TXT: 0" i.e file name followed by count
:: (SS,6/7/12) changed to "binary | 100%" for winscp
find /i /c "binary | 100%" logtoday.txt > findresult.txt
rem check for 3 in results, i.e. 3 successful transfer
rem SS,11/8/11 changed from 3 to 2, no longer backing up to dev.itpartnership.com
rem SS,27/4/12 changed from 2 to 1, ftp.ontheworldweb.com now using FileZilla which returns 226 Transfer OK instead of 226 Transfer complete.
rem SS,4/9/13 changed from 1 to 2, due to new ftp to backup.itpartnership.com
rem SS,8/6/19) changed from 2 to 1, due to removal of backup to backup.itpartnership.com
find "1" findresult.txt
if ERRORLEVEL 1 goto error1
rem (SS,27/4/12) added following to check for "226 Transfer OK" from ftp.ontheworldweb.com / FileZilla
:: (SS,6/7/12) changed to "binary | 100%" for winscp
::find /i "binary | 100%" logtoday.txt
::if ERRORLEVEL 1 goto error1
rem success if this point reached
goto end
:error1
itpSendEmail high surinder@itpartnership.com webbackup@itpartnership.com "ITP ALERT!!! Web Backup Results" logtoday.txt
:end