views:

35

answers:

1
echo "`${BOLD}`  ***** Checking CoreFile Creation *****`${UNBOLD}`"
    echo "========================================================"

    IFS='|'
        cat configMachineDetails.txt | grep -v "^#" | while read MachineType UserName MachineName
        do
        export CHK_COREFILE=`ssh -f -T ${UserName}@${MachineName} ls ~/corefiles | wc -l|sed 's/ //g'`
        if [ $CHK_COREFILE -gt 0 ]
        then    
            echo "CHK_COREFILE $CHK_COREFILE number of core files are created"
            echo "                    "     
            export CHK_COREFILES_NAME=`ls -lrt ~/corefiles`
            echo " Name of the Files $CHK_COREFILES_NAME "
            echo "MachineType $MachineType  UserName $UserName  MachineName $MachineName"

            echo "-----------------------------------------------------"
        fi
    done    

After ssh to different machine it ls to the path of the machine on which the code is running.Hence it says the path not found. export CHK_COREFILE=ssh -f -T ${UserName}@${MachineName} ls ~/corefiles | wc -l|sed 's/ //g'

How to handle this ? working on (ksh) solaris.

+1  A: 

The ssh command that sets CHK_COREFILE only runs its own line on the remote server, which doesn't include ls -lrt ~/corefiles. The simple solution is to change the CHK_COREFILES_NAME assignment to

export CHK_COREFILES_NAME=`ssh -f -T ${UserName}@${MachineName} ls -lrt ~/corefiles`
thnks , silly mistake
Joice