Sending ssh script output to a log file

From: Chris cc (lazyboy_2k@yahoo.com)
Date: Tue Oct 02 2007 - 12:53:45 EDT


Hi All,

Is there a way that I can send all of the output of my below script to a logfile after it's executing so that I can debug it if there is a problem?

#!/bin/ksh
........
# tar up $SOURCE_DIR/search directory on the source host
cd $SOURCE_DIR
tar cf $FILENAME search

# Assign array
set -A target_host_array serv1 serv2 serv3 serv4

# 4 element in the array
typeset -i i=0
typeset -i array_index=4

while [[ $i -lt $array_index ]]
do
        echo ""
        echo " -------- Processing ${target_host_array[$i]} ------- "
        echo ""
        # ftp'ing to the target host
        `ftp -n ${target_host_array[$i]} << END
        quote USER $USER
        quote PASS $PASSWD
        bin
        cd $TARGET_DIR
        put $FILENAME
        bye
        END`

        # login to the host & untar the file
        `ssh ${target_host_array[$i]} -l $LOGIN << EOF
       cd $TARGET_DIR
        tar xf $FILENAME
        ....... do whatever here .....

       rm -r $FILENAME
        exit
        EOF`

        (( i = $i + 1 ))
done

exit 0

Thanks,
-Chris

       
---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:42:23 EDT