ssh Problem

From: Sanjeev Chaudhary (Schaudhary@sapient.com)
Date: Mon Apr 08 2002 - 09:05:33 EDT


Hi All,
        We have got 5 Sun Servers. Currently we have a requirement to copy
one particular file from a specific place
on all the 4 servers and finally put all the files at one server. I am
trying to do this operation through shell script. Basically the
script does ssh to all the machines and run the commands specified. One
important thing is that the file which needs to be copied is
one day old. We have a requirement that the filename cannot be hardcoded in
the script. So while doing ssh, first it should find out
which is the file that is one day old and then scp it from that machine to
the host machine.

        The script i am using has ssh invocation as
                 for IM in $IM_LIST
                        do
                                ssh ${TargetUser}@${IM} ". ./.profile;logs
;cd /home/$TargetUser/bv1to1_var/logs/$IM;LOG=`find . -ctime 1 | grep
bvobs`; echo $LOG ;scp ${LOG}
${DestUser}@${Host}:$ObsLogs/${LOG}.${TargetUser}.${IM}"
                        done

        I am facing 2 ,3 problems here
                First When i am trying to invoke the command logs which is
an alias it says logs : command not found
                Secondly I am trying to get the file name that is to be
copied in a variable named LOG. But the variable
                is empty

                I tried to work around this. I changed the quotes while
invoking ssh to single quotes that is ssh username@hostname 'commands'
                This time the variable LOG got defined but all other
variables like $IM, $TargetUser got undefined. I think it is probably of the
fact that
                you can't interpret $ inside single quotes.
        I am not able to think around this problem. Is there any other
invocation of ssh with specific options which will help me overcome this
problem.

Thanks in advance,
Sanjeev K Chaudhary

_______________________________________________
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:24:10 EDT