/============================================================================= // // Task: SYNCSMPL.TSK // (Synchronization of specific directories between Servers) // Author: Avanti Technology, Inc. // http://www.avanti-tech.com // Version: 1.0 - 25 Apr 2002: Initial Release // 1.1 - 26 Mar 2003: Updated to log elapsed time // 1.2 - 17 Sep 2004: Updated to log summary stats (/# option) // // Description: // ============ // Synchronize the directories and files between the local (source) Server // and a remote (destination) Server and log the processing results. // // Objective: // ========== // Periodically 'SYNC' the remote (destination) directory structure with the // master (source): Replicate to the destination any new files added to // the source; Update any files on the destination which have been modified // on the source; And, Delete any files on the destination which do not // reside on the source. // // Usage: // ====== // Script can be manually executed using the TaskMaster TMRUN command // at the TMConsole (Shell) Screen: // // Example: TMRUN [vol:path\]SYNCSMPL.TSK // // Note: [vol:path\] is not required if the task resides either // in SYS:SYSTEM or the TaskMaster NLM load directory. // // Script can be scheduled for automatic execution using Client interface or // using the TaskMaster TMSCHEDULE command at the TMConsole (Shell) Screen: // // Examples: TMSCHEDULE ADD SYNCSMPL.TSK 01 02:00 // (Executes the 1st of each month at 2:00am) // // TMSCHEDULE ADD SYNCSMPL.TSK YNNNNNN 02:00 // (Executes every Sunday [SMTWTFS] at 2:00am) // // Note: Scheduled tasks must reside either in SYS:SYSTEM or the // TaskMaster NLM load directory for security reasons. // // Compatibility: // ============== // This task has been tested on the following platforms without demonstrating // any compatibility issues or any other reported/confirmed conflicts: // TaskMaster v4.04 (or later) // NetWare v3.12 / v3.2 / v4.1x / v4.2 / v5.x / v6.x // // Warning: // ======== // AS WITH ANY NEW SOFTWARE PROGRAM, BATCH SCRIPT, OR AUTOMATED PROCESSING // PROCEDURE, CAUTION SHOULD BE EXERCISED AND DUE DILIGENCE OBSERVED DURING // INITIAL IMPLEMENTATION. WHERE POSSIBLE, TESTING SHOULD BE PERFORMED ON // NON-PRODUCTION SYSTEMS PRIOR TO FULL IMPLEMENTATION. // // Comments: // ========= // This task script is provided free of charge and without any warranty or // guarantee of fitness of purpose or performance. // // For additional TaskMaster script examples, visit the Sample Tasks page // on the Avanti Technology, Inc. WEB Site: http://www.avanti-tech.com // //============================================================================= // Check that the version of TaskMaster loaded is compatible (4.04 or later) IF "%TM_VERSION%.%TM_SUBVERSION%%TM_REVISION%"<"4.04" // Echo the problem message to the screen ECHO. ECHO Error: Incompatible TaskMaster release (requires v4.04 or later)! ECHO. ABORT ENDIF // Check that no other instances of this task are running (Limit: 1 instance) IF ACTIVE_TASK %TASK% // Echo the problem message to the screen ECHO. ECHO Error: %TASK% is already running! ECHO. ABORT ENDIF // Define the SYNC output log file (check this log for errors after processing) // Notes: SYNC log file name is same as .TSK file name but with .LOG extension. // DEFINE technique is used to simplify subsequent referencing via %9. DEFINE %9 %TASK_PATH%\%TASK_FILE%.LOG // Create/truncate output log file (default = append mode, i.e., w/o TRUNCATE) OPEN_WRITE %9 TRUNCATE // Check if any problems with log file access IF ERRORLEVEL // Echo the problem message to the screen ECHO. ECHO Error: Unable to create/truncate %9! ECHO. ABORT ENDIF // Write the status to the output log WRITE %MONTH%/%DAY% @ %HOUR%:%MINUTE%%AM_PM% - Initiating SYNC processing... WRITE. // Close the output log for use by SYNC (redirected output of SYNC operations) CLOSE // Initiate the three SYNC operations using the following options: // // /A (Add) - add new source file(s) to destination // /D (Delete) - delete any destination file(s) not on source // /H (Hidden) - Hidden/System files are included in the processing // /I (Ignore) - ignore errors (access/InUse) continue processing the next file // /L (Log) - write the command line and options to redirection output file // /S (Subdir) - subdirectory processing (i.e., recursion) // /V (Verify) - verify file(s), update destination if date/time/size differs // /# (Stats) - Include processing statistics in final summary // >>%9 - redirect the console output to the %9 defined file (i.e., log) // // Note: Change the source vol:path and destination server/vol:path to customize. SYNC VOL:\PATH\*.* REMOTE_SERVER/VOL:\PATH /A /D /H /I /L /S /V /# >>%9 // Re-open the log file (default = append mode), record the status, and close it OPEN_WRITE %9 WRITE. WRITE %MONTH%/%DAY% @ %HOUR%:%MINUTE%%AM_PM% - Finished SYNC processing... WRITE. // Close the log file CLOSE