home *** CD-ROM | disk | FTP | other *** search
- :
- ##############################################################################
- #
- # Example system script using Digital Equipment Corp (DEC) VAX VMS as basis
- #
- # Areas that will often be customized are indicated by a comment of the form:
- #
- #-------------------------------------------------------------------------------
- # Description of what follows
- #-------------------------------------------------------------------------------
- #
- # Structure of a system script
- #
- # 1) Optional comments -- any comments preceding the index tag start with a
- # colon (:) on a line by itself. This tells the
- # index program to keep these lines. If it is
- # omitted, the leading comments will be lost during
- # the indexing process.
- # 2) Index tag ---------- A colon (:) followed by up to eight charaters.
- # This is the name to use in the System Type field
- # of the Setup. System Type ignores the case of the
- # entries in the systems.scr index.
- # 3) Entry points ------- Each entry point returns 0 if successful.
- # Unsuccessful results are indicated by returning
- # 1 of not running AutoPoll, -2 for .LOGON & .LOGOFF
- # and -3 for .TRANSFER when running AutoPoll.
- # Four entry points are required in a system script:
- # .LOGON ---- Generally, .LOGON sends a USERID and
- # PASSWORD in response to the operating
- # system's prompts. This section should
- # also be used to "navigate" through any
- # data security devices or network con-
- # nections. AutoPoll uses line 12 of the
- # display for logon messages.
- # .LOGOFF --- Used to terminate a user session on the
- # called computer. This section is
- # called prior to instructing the modem
- # to hang up. AutoPoll uses line 14 of
- # the display for logoff messages.
- # .UPLOAD --- Performs the non-error-checked upload of
- # a text file. This is often referred to
- # as an "ASCII upload". AutoPoll does not
- # support the UPLOAD function.
- # .TRANSFER - Starts BLAST on the remote computer.
- # AutoPoll uses line 13 of the display
- # for File Transfer messages.
- # 4) Terminator --------- The label ".END".
- #
- ##############################################################################
- #
- #-------------------------------------------------------------------------------
- # Index tag (change this to the name you want to use in the System Type field)
- #-------------------------------------------------------------------------------
- :Custom
- #########################################
- # #
- # LOGON #
- # #
- #########################################
- .LOGON
- if not null @USERID goto .LOG10 # Make sure that there is a USERID
- if @SCRFILE not = "AutoPoll" # Only ask the user if not in AutoPoll
- ask "enter account", @USERID
- if null @USERID return 0 # Return success if user insists on no USERID
- goto .LOG10 # Otherwise, continue with LOGON
- end
- #
- # AutoPoll Status file update
- #
- # Each "log" line in the status file is preceded by 18 spaces
- # Informational messages should have a "*" in the 19th position
- # Error messages should have ">>" in the 19th and 20th positions
- fwrite 4, " >> CHECK SETUP FILE (",@su_fil,") - No USERID specified"
- #
- # AutoPoll Screen display
- #
- # @USERIF tracks the setting of the "/n" (no display) command line option
- # If /n was used, @USERIF = "0". Otherwise it is "1".
- # If the USER InterFace is active (= "1") update the status display.
- #
- if @USERIF = "1"
- set @SCRLREG = "1" # Turn on the scrolling region
- #
- # The next two commands (with varying row and column numbers) must occur after
- # each time you enable the scrolling region. This will maintain compatibility
- # with certain version of BLAST that fail to position the cursor properly
- # immediately after turning on the scrolling region. Always use the position
- # of the "real" string location and always use " " as the string to put.
- #
- cursor 12,0 # Position the cursor
- put " " # Display "nothing" there
- #
- # The next 4 lines update the online status display.
- # Columns 0-2 contain either "-->" or " " to indicate that the task on that
- # line is in process or done, respectivley. Column 3 remains blank until the
- # task is done. It is changed to a "*" if the task was successful, "X" if not.
- # The status message area starts in column 15 and extends thru column 79.
- #
- cursor 12,0 # In this case the task failed...
- put " X" # so replace the "--> " with " X"
- cursor 12,15 # and add the error message text
- put "SETUP FILE ",@su_fil," - No USERID specified"
- cleol # and clean up the rest of the line.
- set @SCRLREG = "0" # Done, turn scrolling region off.
- end
- return -2 # Return -2, to indicate logon failed.
- #
- # Comes here if there is a USERID
- #
- .LOG10
- if not null @PASSWORD goto .LOG15 # Go on, if the PASSWORD is filled in
- if @SCRFILE not = "AutoPoll" # If not running AutoPoll, ask for one
- ask noecho "enter password", @PASSWORD
- if null @PASSWORD return 0 # If user insists on none, return success
- goto .LOG15
- end
- #
- # AutoPoll Status file update
- #
- fwrite 4, " >> CHECK SETUP FILE (",@su_fil,") - No PASSWORD specified"
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1"
- set @SCRLREG = "1"
- cursor 12,0
- put " "
- cursor 12,0
- put " X"
- cursor 12,15
- put "SETUP FILE ",@su_fil," - No PASSWORD specified"
- cleol
- set @SCRLREG = "0"
- end
- return -2
- .LOG15
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 12,0
- put " "
- cursor 12,0
- put "--> "
- set @SCRLREG = "0"
- end
- #-------------------------------------------------------------------------------
- # Determines how many times to retry the login procedure
- #-------------------------------------------------------------------------------
- reps 5
- #
- # AutoPoll Screen display
- #
- .LOG20
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 12,15
- put " "
- cursor 12,15
- put "Looking for ",@SYSTYPE," Username prompt"
- cleol
- set @SCRLREG = "0"
- end
- #-------------------------------------------------------------------------------
- # Send something to get the Username prompt (or equivalent)
- #-------------------------------------------------------------------------------
- tsend CR, CR
- #-------------------------------------------------------------------------------
- # Look for the most likely responses
- #-------------------------------------------------------------------------------
- ttrap 5 "name:","word:","$","authorization fail"
- if @STATUS = "1" goto .LOG30
- if @STATUS = "2"
- tsend CR
- goto .LOG20
- end
- if @STATUS = "3"
- tsend "LOGOFF", CR
- goto .LOG20
- end
- .LOG25
- #-------------------------------------------------------------------------------
- # Send a Ctrl-Q (\021) to try and restart output from remote system
- # Also send a Ctrl-Y (\031) to try and abort any application running on remote
- #-------------------------------------------------------------------------------
- tsend "\021\031"
- if @SCRFILE = "AutoPoll" fwrite 4, " * Attempting to get ",@SYSTYPE," system's attention"
- if reps goto .LOG20
- #
- # Can't log in, inform user and exit
- #
- if @SCRFILE = "AutoPoll" fwrite 4, " >> CHECK SETUP FILE (",@su_fil,") - Remote not responding with Userid prompt for ",@SYSTYPE
- else return 1
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1"
- set @SCRLREG = "1"
- cursor 12,0
- put " "
- cursor 12,0
- put " X "
- cursor 12,15
- put "CHECK SETUP ",@su_fil," - Wrong System Type?"
- cleol
- set @SCRLREG = "0"
- end
- return -2
- #
- # Comes here when the prompt for the user name is detected
- #
- .LOG30
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 12,15
- put " "
- cursor 12,15
- put "Sending UserId"
- cleol
- set @SCRLREG = "0"
- end
- #-------------------------------------------------------------------------------
- # Send the user name data (usually just the @USERID variable and a return)
- #-------------------------------------------------------------------------------
- tsend @USERID, CR # enter USERID
- #-------------------------------------------------------------------------------
- # Wait for the most likely responses
- #-------------------------------------------------------------------------------
- ttrap 10 "word:","$","authorization fail" # wait for PASSWORD prompt
- if @STATUS = "2" goto .LOG50
- if @STATUS = "0" or @STATUS = "3" goto .LOG25
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 12,15
- put " "
- cursor 12,15
- put "Sending Password"
- cleol
- set @SCRLREG = "0"
- end
- #-------------------------------------------------------------------------------
- # Send the password data (usually just the @PASSWORD variable + return)
- #-------------------------------------------------------------------------------
- tsend @PASSWORD, CR # enter PASSWORD
- #-------------------------------------------------------------------------------
- # Look for the system prompt (or whatever indicates that you are logged on)
- #-------------------------------------------------------------------------------
- ttrap 20 "$","authorization fail"
- if @STATUS = "1"
- .LOG50
- if @USERIF = "0" or @SCRFILE NOT = "AutoPoll" return 0
- #
- # AutoPoll Screen display
- #
- set @SCRLREG = "1"
- cursor 12,0
- put " "
- cursor 12,0
- put " *"
- cursor 12,15
- put "Logged on"
- cleol
- set @SCRLREG = "0"
- return 0 # got a system prompt
- end
- #
- # Incorrect USERID/PASSWORD - perhaps it was corrupted in transit
- #
- if @SCRFILE = "AutoPoll" fwrite 4, " * Re-trying LOGIN - noise may have corrupted Username/Password exchange"
- if reps goto .LOG20
- if @SCRFILE = "AutoPoll" fwrite 4, " >> CHECK SETUP FILE (",@su_fil,") - Userid/Password not valid or noisy line"
- else return 1
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1"
- set @SCRLREG = "1"
- cursor 12,0
- put " "
- cursor 12,0
- put " X"
- cursor 12,15
- put "CHECK SETUP ",@su_fil," - bad Username/Password or line noise"
- cleol
- set @SCRLREG = "0"
- end
- return -2
- #########################################
- # #
- # LOGOFF #
- # #
- #########################################
- .LOGOFF
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 14,0
- put " "
- cursor 14,0
- put "--> "
- cursor 14,15
- put "Looking for operating system prompt"
- set @SCRLREG = "0"
- end
- #-------------------------------------------------------------------------------
- # Determine the number of times to attempt the logoff
- #-------------------------------------------------------------------------------
- reps 4 # try 4 times
- #
- .LGF10
- #-------------------------------------------------------------------------------
- # Look for a recognizable response from the remote system
- #-------------------------------------------------------------------------------
- tsend CR # get system prompt
- #-------------------------------------------------------------------------------
- # Handle the most likey responses
- #-------------------------------------------------------------------------------
- ttrap 5 "$","name:","word:","authorization fail"
- if @STATUS = "1" goto .LGF20 # VMS sys prompt
- if @STATUS = "2" or @STATUS = "4" goto .LGF25
- #
- if reps
- #-------------------------------------------------------------------------------
- # Send a Ctrl-Q (\021) to try and restart output from remote system
- # Also send a Ctrl-Y (\031) to try and abort any application running on remote
- #-------------------------------------------------------------------------------
- tsend "\021\031"
- goto .LGF10
- end
- #
- # Unable to get anything recognizable - abort
- #
- if @SCRFILE = "AutoPoll" fwrite 4, " >> CHECK SETUP FILE (",@su_fil,") - LOGOFF Failed: Remote not responding as expected for ",@SYSTYPE
- else return 1
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1"
- set @SCRLREG = "1"
- cursor 14,0
- put " "
- cursor 14,0
- put " X"
- cursor 14,15
- put "CHECK SETUP ",@su_fil," - Could not find operating system prompt"
- cleol
- set @SCRLREG = "0"
- end
- return -2
- #
- .LGF20 # VMS logout
- #-------------------------------------------------------------------------------
- # Send the command to terminate this user session
- #-------------------------------------------------------------------------------
- tsend "LOGOFF",CR
- #
- # AutoPoll Screen display
- #
- .LGF25
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 14,0
- put " "
- cursor 14,0
- put " *"
- cursor 14,15
- put "Logged off"
- cleol
- set @SCRLREG = "0"
- end
- return 0
- #########################################
- # #
- # UPLOAD #
- # #
- #########################################
- .UPLOAD
- if @SCRFILE = "AutoPoll"
- werror "UPLOAD not supported by AutoPoll"
- fwrite 4, " >> UPLOAD not supported"
- return -2
- end
- ask "enter filename to upload", @filename
- if null @filename return 0
- if exist @filename goto .UPL10
- werror "can't open ", @filename
- return 1
- #
- .UPL10
- ask "enter remote filename or <RETURN> to upload to system", @remotefn
- if null @remotefn goto .UPL20
- #-------------------------------------------------------------------------------
- # Send a Ctrl-Y (\031) to abort any application running on remote
- # Send a return to get the system prompt
- #-------------------------------------------------------------------------------
- tsend "\031",cr
- #-------------------------------------------------------------------------------
- # Handle the most likely responses
- #-------------------------------------------------------------------------------
- ttrap 5 "$"
- if 0 return 1
- #
- # If no remote filename given, assume file already open on receiving system
- #
- #-------------------------------------------------------------------------------
- # Send the operating system command to create a text file
- #-------------------------------------------------------------------------------
- tsend "create ",@remotefn,cr
- #-------------------------------------------------------------------------------
- # Delay a short while to allow the command get started (could also use "wait")
- #-------------------------------------------------------------------------------
- ttrap 2
- .UPL20
- tupload @filename
- #-------------------------------------------------------------------------------
- # Delay a while to allow the remote system to get finished
- #-------------------------------------------------------------------------------
- wait 2 idle
- #
- if null @remotefn return 0
- #-------------------------------------------------------------------------------
- # Send the string to tell the remote operating system command that you're done
- #-------------------------------------------------------------------------------
- tsend "\032"
- #-------------------------------------------------------------------------------
- # Handle the most likely responses
- #-------------------------------------------------------------------------------
- ttrap 5 "$"
- if 1 return 0
- return 1
- #########################################
- # #
- # TRANSFER #
- # #
- #########################################
- .TRANSFER
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 13,0
- put " "
- cursor 13,0
- put "--> "
- cursor 13,15
- put "Looking for operating system prompt"
- set @SCRLREG = "0"
- end
- #-------------------------------------------------------------------------------
- # Determine the number of times to attempt to get file transfer started
- #-------------------------------------------------------------------------------
- reps 4
- #
- .TRANS10
- #-------------------------------------------------------------------------------
- # Send something that should elicit a response from the remote system
- #-------------------------------------------------------------------------------
- tsend CR
- #-------------------------------------------------------------------------------
- # Handle the most likely responses. Must include the strings sent by BLAST A,
- # B and C protocols (a string of p's or some part of the message
- # ";starting BLAST protocol." Usually also includes: the system prompt and
- # application or system error messages - as below.
- #-------------------------------------------------------------------------------
- ttrap 10 "$","protocol","ppp","%DCL-"
- if @STATUS = "2" or @STATUS = "3" return 0
- if @STATUS = "1" goto .TRANS20
- if @STATUS = "4"
- if @SCRFILE = "AutoPoll" fwrite 4, " * CHECK REMOTE SYSTEM - BLAST symbol incorrectly defined"
- else goto .TRANS15
- if @USERIF = "0" goto .TRANS15
- #
- # AutoPoll Screen display
- #
- set @SCRLREG = "1"
- cursor 13,15
- put " "
- cursor 13,15
- put "CHECK REMOTE SYSTEM - BLAST symbol incorrectly defined"
- cleol
- set @SCRLREG = "0"
- end
- .TRANS15
- if reps
- #-------------------------------------------------------------------------------
- # Send a Ctrl-Q (\021) to try and restart output from remote system
- # Also send a Ctrl-Y (\031) to try and abort any application running on remote
- #-------------------------------------------------------------------------------
- tsend "\021\031"
- goto .TRANS10
- end
- #
- # Unable to get anything recognizable on remote computer - abort
- #
- if @SCRFILE = "AutoPoll" fwrite 4, " >> CHECK REMOTE SYSTEM - Unable to get ",@SYSTYPE," system prompt after login"
- else return 1
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1"
- set @SCRLREG = "1"
- cursor 13,0
- put " "
- cursor 13,0
- put " X "
- cursor 13,15
- put "CHECK REMOTE - System not responding in time"
- cleol
- set @SCRLREG = "0"
- end
- return -3
- .TRANS20
- #-------------------------------------------------------------------------------
- # Send the operating system command which will start BLAST in Host mode
- #-------------------------------------------------------------------------------
- tsend "BLAST /H",CR # invoke BLAST in host mode
- #
- # AutoPoll Screen display
- #
- if @USERIF = "1" and @SCRFILE = "AutoPoll"
- set @SCRLREG = "1"
- cursor 13,15
- put " "
- cursor 13,15
- put "Waiting for BLAST protocol"
- cleol
- set @SCRLREG = "0"
- end
- goto .TRANS10
- .END