Nasty what the email server did to my original code. Here is a plain text one.
-----Original Message----- From: Williamson, Scott Sent: Tuesday, December 30, 2003 4:01 PM To: 'Ahmed Hassan' Cc: [EMAIL PROTECTED] Subject: RE: [SA-list] Ideas from Group Ahmed, Robocopy returns an errorlevel code that can be used to determine if a failure happened. In addition to copying the reports why not just create a new file with the status of the run. This will also catch a failure even if ROBOCOPY does not create a log file. For Example: REM ROBOCHECK.BAT if exist status.txt del status.txt ROBOCOPY \\remoteserver\sourcepath \\localserver\destpath ... REM If not report exists assume robocopy failed. if not exist report.txt set ERRORLEVEL=16 REM if errorlevel 8 or 16 create the status.txt file. if errorlevel 16 echo FATAL ERROR - REMOTESERVER > status.txt if errorlevel 16 goto end if errorlevel 8 echo FAILED - REMOTESERVER > status.txt if errorlevel 8 goto end :end REM Copy the status.txt file to the SA server with a different name. REM The user\process that runs this batch file needs to have write access to the share below. if exist status.txt copy status.txt \\SASERVER\SHARE\REMOTESERVER.TXT On the SASERVER create a bat file that returns an errorcode if REMOTESERVER.TXT exists. For example: REM REMOTESERVER.BAT @echo off REM Sets error level for SA to act on... if exist REMOTESERVER.TXT set ERRORLEVEL=1 REM Archive Error file for review... if exist REMOTESERVER.TXT if exist REMOTESERVER.OLD del REMOTESERVER.old if exist REMOTESERVER.TXT ren REMOTESERVER.TXT REMOTESERVER.OLD exit Then in SA create an errorlevel check ">0" that runs the batch file. Hope this helps, Scott -----Original Message----- From: Ahmed Hassan [mailto:[EMAIL PROTECTED] Sent: Thursday, November 06, 2003 10:34 AM To: [EMAIL PROTECTED] Subject: RE: [SA-list] Ideas from Group The log file is replaced at every run. Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger To unsubscribe from a list, send a mail message to [EMAIL PROTECTED] With the following in the body of the message: unsubscribe SAlive
