Foil 15 - Handling mixed remote environments (3/3)

 1           * )
 2             echo "Unknown system type, value=$client_type"
 3             client_type=unknown
 4           ;;
 5         esac # End of case
 6         if [ "$client_type" != "unknown" ]
 7           then
 8             # Query the remote system and save results to variables.
 9             file_info="`$rsh_cmd ${client} \"cd $client_dir;ls -ld
10                rc.adsm;egrep 'Version 2|ERRORLOGRETENTION|TAPEPROMPT'
11                dsm.sys dsm.opt backup.excl\" </dev/null 2>&1`"
12             ######## Output the results.
13             echo "------------ $client_name $client_type ------------"
14             echo "$file_info" | awk '{printf "%-60.60s\n",$0}'
15           fi
16 
17       else
18         ######## If the remote system did not respond.
19         echo "timed out @ `date +%y%m%d.%H%M%S`"
20       fi
21 
22   done | tee -a ${log_file}                                        #15

This is the third of five slides showing the more complex, but very useful of performing operations on remote systems. The third through fifth slides expand on the previous slide to handle a complex mix of different client operating systems, applications, etc.

The fifth slide completes the operating system dependent section and actually executes the commands on the remote system. starts determining the operating system on the remote system. This continues on the fourth slide.

  • Lines 9-11 execute a series of commands of commands on the remote system and assign the output to a variable. Standard error is added to the standard output so it is assigned to the variable. Note how the client_dir variable is passed to the remote system.
  • Line 14 takes all the output and formats it for the report.
  • Line 22 sends the output to a log file and the terminal. Input is not redirected here so it will need to be done from the command line.

    Standard input is redirected to /dev/null on the remote shell command so commands that read standard input won't read the client list from the main system.

    Previous   Next   Index