/============================================================================= // // Task: TM_PING.TSK // (Check for TaskMaster Server availability) // Author: Avanti Technology, Inc. // http://www.avanti-tech.com // Version: 1.0 - 26 Nov 2004: Initial Release // // Description: // ============ // Check if a Server exists and has the TaskMaster NLM loaded. // // Objective: // ========== // Logic can also be incorporated into other tasks for use as a // pre-check for Server-to-Server operations. // // Usage: // ====== // Script can be manually executed using the TaskMaster TMRUN command // at the TMConsole (Shell) Screen: // // Example: TMRUN [vol:path\]TM_PING.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 TM_PING.TSK 01 02:00 // (Executes the 1st of each month at 2:00am) // // TMSCHEDULE ADD TM_PING.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 // Clear for use as re-try counter DEFINE %0 00 // While/Loop to TM Ping Remote Server (change 20 to max retries desired) WHILE "%0"<"20" // STMINFO attempts to retrieve the TakMaster NLM info from [RemoteServer] // If successful, the information is redirected to a temporary log file. STMINFO [RemoteServer] >%TASK_PATH%\%TASK_FILE%.TMP // If Successful, no need to continue re-try loop so break IF NOT ERRORLEVEL THEN BREAK // Unsuccessful so sleep (wait) a bit (15 seconds) before trying again SLEEP 15 // Increment the retry counter so we can stop this craziness sometime DEFINE %0 %0+=01 LOOP // Check if While/Loop resulted in success ("%0"<"20") or failure ("%0"=="20") IF "%0"=="20" ... insert notification / logging commands prior to exiting task ... EXIT ENDIF // Continue with processing since [RemoteServer] is up and running TaskMaster