3.8.5 How to handle adshecho and adshread commands that terminate with an error
If the adshecho or adshread command terminates with an error, its re-execution might result in successful command processing. To re-execute the adshecho or adshread command, create a job definition script for re-executing the command by referencing the following example:
#! /opt/jp1as/bin/adshexec ### #Function executing the adshread command #Argument: Reply-request message #Return code: 0 (normal termination) # 1 (terminated with a retryable error) # 2 (terminated with a non-retryable error) ### func_adshread() { adshread ans "$1" case "$?" in # Normal termination 0 ) return 0 ;; # When terminated with a retryable error 3 | 4 | 6 | 8 ) return 1 ;; # When terminated with any other error * ) return 2 ;; esac } ### ### Body of script ### # # Specify a process that is to be executed as a job # ### ### Wait for the operator's reply before resuming processing ### while : do #Call the function that executes the adshread command func_adshread "Do you want to resume processing?(Y/N) [host name: $HOSTNAME, script name: $0]" if [ $? = 0 ]; then #The adshread command terminated normally break #Exit the loop elif [ $? = 1 ] ; then #The adshread command terminated with a retryable error continue #Re-execute the adshread command else #The adshread command terminated with a non-retryable error echo "The adshread command terminated with an error." exit 1 #Terminate the script fi done ### ### Perform processing according to the reply received by adshread ### if [ "$ans" = "Y" ] ; then adshecho "Y was entered. The processing will be resumed." elif [ "$ans" = "N" ] ; then adshecho "N was entered. The processing will be terminated." exit 1 #Terminate the script else adshecho "An invalid reply was entered. The processing will be terminated." exit 1 #Terminate the script fi