<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script regarding ssh in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5415221#M640236</link>
    <description>&lt;P&gt;Hi Dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script i am running on serverB through ssh is as below. I used set -x option also in the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#!/usr/bin/sh&lt;BR /&gt;set -x&lt;BR /&gt;for i in abc*.xyz&lt;BR /&gt;do&lt;BR /&gt;if&amp;nbsp; (test -f&amp;nbsp; "$i")&lt;BR /&gt;then&lt;BR /&gt;newname=${i#abc}&lt;BR /&gt;/usr/bin/mv $i /home/rtns/testdir2/$newname&lt;BR /&gt;fi&lt;BR /&gt;done&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it is giving the output as:&lt;/P&gt;&lt;P&gt;+ test -f abc*.xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I run the above script on serverB itself and it is running successfully. But using ssh to run this script giving the above message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
    <pubDate>Mon, 12 Dec 2011 11:19:25 GMT</pubDate>
    <dc:creator>rahul_rtns</dc:creator>
    <dc:date>2011-12-12T11:19:25Z</dc:date>
    <item>
      <title>script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5401945#M640207</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suppose i am logged in server 1. I want to ssh to server 2. There I want to check for the presence of a particular type of files ( for eg .dbf files in /somepath). Then if the file is present, it has to exit ssh and trigger another&amp;nbsp;script (for eg backup.ssh at /somepath2) &amp;nbsp;which is there in server 1. But if the file is not present in server 2 then nothing should happen.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2011 10:48:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5401945#M640207</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-11-28T10:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402047#M640208</link>
      <description>&lt;P&gt;You should be able to use ssh and ls to list the files you want.&lt;/P&gt;&lt;P&gt;Then grep the output and if present run that other script:&lt;/P&gt;&lt;P&gt;ssh server2 ls "/somepath/*.dbf" | grep -q "/somepath/.*\.dbf"&lt;/P&gt;&lt;P&gt;if [ $? -eq 0 ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /somepath2/backup.ssh&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: This assumes that you can use ls instead of using find to search a whole tree.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2011 12:30:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402047#M640208</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-28T12:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402099#M640209</link>
      <description>Instead of using&lt;BR /&gt;&lt;BR /&gt;ssh server2 ls "/somepath/*.dbf" | grep -q "/somepath/.*\.dbf"&lt;BR /&gt;&lt;BR /&gt;can i use :&lt;BR /&gt;&lt;BR /&gt;ssh server2 test -f /somepath/*.dbf&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:04:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402099#M640209</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-11-28T13:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402113#M640210</link>
      <description>&lt;P&gt;&amp;gt;can I use: ssh server2 test -f /somepath/*.dbf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No.&amp;nbsp; -f only takes one file, not a pattern.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:15:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402113#M640210</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-28T13:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402125#M640211</link>
      <description>Thnx..&lt;BR /&gt;&lt;BR /&gt;May i know the meaning of this line :&lt;BR /&gt;&lt;BR /&gt;if [ $? -eq 0 ];&lt;BR /&gt;&lt;BR /&gt;What will $? -eq 0 do?&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Mon, 28 Nov 2011 13:22:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402125#M640211</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-11-28T13:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402131#M640212</link>
      <description>&lt;P&gt;&amp;gt;What will $? -eq 0 do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This checks the exit status of the previous command.&amp;nbsp; In this case, grep found some matches in the ls output.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:25:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402131#M640212</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-28T13:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402153#M640213</link>
      <description>Thnx Dennis,&lt;BR /&gt;Just one more point :&lt;BR /&gt;&lt;BR /&gt;I want to ssh to the server and want to login using root credentials. May i know how in every ssh it will login with root and will not ask for password. If the password need to be given, then how can it be applied in the script.&lt;BR /&gt;&lt;BR /&gt;Regards..&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:33:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402153#M640213</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-11-28T13:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402165#M640214</link>
      <description>&lt;P&gt;&amp;gt;I want to ssh to the server and want to login using root credentials.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to search for topics about setting up ssh:&lt;/P&gt;&lt;P&gt;&lt;A href="http://h30499.www3.hp.com/t5/System-Administration/Cannot-passwordlessly-ssh-using-root/m-p/5381979/" target="_blank"&gt;http://h30499.www3.hp.com/t5/System-Administration/Cannot-passwordlessly-ssh-using-root/m-p/5381979/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://h30499.www3.hp.com/t5/System-Administration/SSH-question/m-p/4299800/" target="_blank"&gt;http://h30499.www3.hp.com/t5/System-Administration/SSH-question/m-p/4299800/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://h30499.www3.hp.com/t5/Security/how-to-install-and-setup-SSH-with-SFTP-on-hpux-11-00/m-p/4421118/" target="_blank"&gt;http://h30499.www3.hp.com/t5/Security/how-to-install-and-setup-SSH-with-SFTP-on-hpux-11-00/m-p/4421118/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://h30499.www3.hp.com/t5/General/SSH-Host-based-Authentication-setup/m-p/4902860/" target="_blank"&gt;http://h30499.www3.hp.com/t5/General/SSH-Host-based-Authentication-setup/m-p/4902860/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:39:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402165#M640214</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-28T13:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402173#M640215</link>
      <description>thnx..&lt;BR /&gt;&lt;BR /&gt;Can i use local user to run the script. What is the procedure to run the script by local user..&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Mon, 28 Nov 2011 13:42:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402173#M640215</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-11-28T13:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402187#M640216</link>
      <description>&lt;P&gt;&amp;gt;Can I use local user to run the script?&amp;nbsp; What is the procedure to run the script by local user?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You don't need to be root, you just need to be able to list those directories.&lt;/P&gt;&lt;P&gt;You have to do the same ssh setup, except you don't need to give away the keys to the city by using root.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2011 13:48:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5402187#M640216</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-28T13:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5405191#M640218</link>
      <description>&lt;P&gt;Hello..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As per you given script above i have made a test script as below :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="mailto:root@serverA:/home/rtns%3Ecat"&gt;root@serverA:/home/rtns&amp;gt;cat&lt;/A&gt; testscript&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;ssh&amp;nbsp;&lt;A target="_blank" href="mailto:rets@serverB"&gt;rets@serverB&lt;/A&gt; ls "/home/rtns/a/*.abc" | grep -q "MPF*.abc"&lt;BR /&gt;if [$? -eq 0]; then&lt;BR /&gt;rmdir abc&amp;nbsp; (abc dirctory i have temporarily made in /home/rtns)&lt;BR /&gt;fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Already i am able to do passwordless ssh and able to list the files. But when running this script i am gettin below error :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="https://community.hpe.com/"&gt;root@serverA:/home/rtns&amp;gt;./testscript&lt;/A&gt;&lt;BR /&gt;./testscript[3]: [1:&amp;nbsp; not found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;following test files i have created in serverB in /home/rtns/a :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;1_66.abc&lt;BR /&gt;&amp;nbsp;2_66.abc&lt;BR /&gt;&amp;nbsp;MPF1_1_66.abc&lt;BR /&gt;&amp;nbsp;MPF1_2_66.abc&lt;BR /&gt;&amp;nbsp;MPF1_3_66.abc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please mention in the script where i am doing a mistake.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2011 11:21:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5405191#M640218</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-11-30T11:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5405527#M640219</link>
      <description>&lt;P&gt;if [$? -eq 0]; then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; rmdir abc&amp;nbsp; # (abc directory I have temporarily made in /home/rtns)&lt;BR /&gt;fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;when running this script I am getting below error :&lt;/P&gt;&lt;P&gt;./testscript[3]: [1:&amp;nbsp; not found.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Spacing is important when using [ ] or [[ ]].&amp;nbsp; You need to cut&amp;amp;paste from the post:&lt;/P&gt;&lt;P&gt;if [ $? -eq 0 ]; then&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note the "1" comes from $? which indicates the grep failed.&amp;nbsp; There is a typo there in the regex, change to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; ssh rets@serverB ls "/home/rtns/a/*.abc" | grep -q "MPF.*\.abc"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: grep takes a regex but ls(1) takes a pattern.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;rmdir abc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This isn't likely to work if abc still contains files.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Nov 2011 15:08:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5405527#M640219</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-11-30T15:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5407543#M640220</link>
      <description>&lt;P&gt;Hi Dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank u very much for ur support.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution worked..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But i m having one more concern:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ssh &lt;A target="_blank" href="mailto:rtns@serverB"&gt;rtns@serverB&lt;/A&gt; ls "/home/rtns/a/*.abc" | grep -q "MPF.*\.abc"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The above command checks all the files of MPF*.abc in serverB. The concern i m having is in serverA the files are generated with .abc extension and with serial nos. For e.g. 1_46446_652110140.abc, 1_46447_652110140.abc and so on. And in serverB they are shipped as MPF1_46446_652110140.abc, MPF1_46447_652110140.abc and so on. I want script that should check&amp;nbsp;that a&amp;nbsp;particular no. of file that has been generated on serverA has been shipped on serverB or not. Say in above case like if 46th file is generated on serverA and if it is shipped in serverB, then it should check the presence of 46th file on serverB and&amp;nbsp;then only it should trigger the other script in serverA. And if the file is not present nothing should happen.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 07:00:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5407543#M640220</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-12-02T07:00:59Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5408007#M640221</link>
      <description>&lt;P&gt;&amp;gt;serverA:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1_46446_652110140.abc, ...&lt;/P&gt;&lt;P&gt;&amp;gt;serverB: MPF1_46446_652110140.abc, ...&lt;/P&gt;&lt;P&gt;&amp;gt;I want script that should check that a particular no. of file that has been generated on serverA has been shipped on serverB or not. Say in above case like if 46th file is generated on serverA and if it is shipped in serverB, then it should check the presence of 46th file on serverB and then only it should trigger the other script in serverA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you want to check to see if there is a match on ALL files that are copied to serverB?&lt;/P&gt;&lt;P&gt;Or do you want to invoke that script if the matching files are on both machines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And do you want to invoke the script for each match or only once if any matches?&lt;/P&gt;</description>
      <pubDate>Fri, 02 Dec 2011 16:56:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5408007#M640221</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-12-02T16:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5408325#M640222</link>
      <description>&lt;DIV&gt;&lt;P&gt;&amp;gt;&amp;gt;Do you want to check to see if there is a match on ALL files that are copied to serverB?&lt;/P&gt;&lt;P&gt;Or do you want to invoke that script if the matching files are on both machines?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will run the script through crontab. I want to invoke the script if the matching files are on both machines. And the script should not run if the file that is present on serverA has not shipped to serverB. That is if file is present on serverA and not present on serverB, then script should not run. That match should be regarding the particular no. of file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please revert if any more concern is there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Sat, 03 Dec 2011 03:02:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5408325#M640222</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-12-03T03:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5408545#M640223</link>
      <description>&lt;P&gt;&amp;gt;I want to invoke the script if the matching files are on both machines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So you don't care if there are extra files on serverA or serverB.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# get basenames&amp;nbsp;of files on each server&lt;/P&gt;&lt;P&gt;ls /serverA-path/*.abc | sed -e 's:.*/::g' &amp;gt; serverA_files&lt;/P&gt;&lt;P&gt;ssh rtns@serverB ls "/home/rtns/a/*.abc" | grep "MPF.*\.abc" | sed -e 's:.*/MPF::g' &amp;gt; serverB_files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# find matches:&lt;/P&gt;&lt;P&gt;comm -12 serverA_files&amp;nbsp;serverB_files &amp;gt; matched_files&lt;/P&gt;&lt;P&gt;if [ -s matched_files ]; then&amp;nbsp; # some matches&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run-script-here&lt;/P&gt;&lt;P&gt;fi&lt;/P&gt;&lt;P&gt;rm -f matched_files # cleanup&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2011 23:02:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5408545#M640223</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-12-03T23:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5409189#M640224</link>
      <description>&lt;P&gt;Hi dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank u very much for the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I m having some queries about the script that i am mentioning below :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;# get basenames&amp;nbsp;of files on each server&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ls /serverA-path/*.abc | sed -e 's:.*/::g' &amp;gt; serverA_files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ssh rtns@serverB ls "/home/rtns/a/*.abc" | grep "MPF.*\.abc" | sed -e 's:.*/MPF::g' &amp;gt; serverB_files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What are the serverA_files and serverB_files. Are they the folders that i have to make in respective directories. In the severB the .abc files are having MPF extension also. Whether that MPF will be removed while matching the files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;comm -12 serverA_files&amp;nbsp;serverB_files &amp;gt; matched_files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if [ -s matched_files ]; then&amp;nbsp; # some matches&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run-script-here&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rm -f matched_files # cleanup&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If some files are matched only, then also the script will run or the script will run only after all files are matched. My concern is to invoke the script only after all files on serverA and serverB are matched. If only some files are matched, then script should not run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2011 11:25:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5409189#M640224</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-12-05T11:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5409573#M640225</link>
      <description>&lt;P&gt;&amp;gt;What are the serverA_files and serverB_files. In the serverB the .abc files are having MPF extension also. Whether that MPF will be removed while matching the files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are files that contain the list of files on each machine.&lt;/P&gt;&lt;P&gt;The sed command will remove the leading "MPF".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;My concern is to invoke the script only after all files on serverA and serverB are matched. If only some files are matched, then script should not run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok, then:&lt;/P&gt;&lt;P&gt;# find matches:&lt;BR /&gt;cmp -s serverA_files serverB_files&lt;BR /&gt;if [ $? -eq 0 ]; then&amp;nbsp; # all matched&lt;BR /&gt;&amp;nbsp;&amp;nbsp; run-script-here&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; echo "Some files not matched:"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; comm -3 serverA_files serverB_files&lt;/P&gt;&lt;P&gt;fi&lt;BR /&gt;&lt;BR /&gt;rm -f&amp;nbsp; serverA_files serverB_files # cleanup&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2011 17:04:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5409573#M640225</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-12-05T17:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5411245#M640226</link>
      <description>&lt;P&gt;Hi dennis,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank u very much for the script. I am having a couple of questions for the above script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;nbsp;&amp;nbsp;if [ $? -eq 0 ]; then&amp;nbsp; # all matched&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /pathtoscript/backup.sh&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; whether the script will successfully run&amp;nbsp;by typing the script as above. Or is there any other way to run the script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;else&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Some files not matched:"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; comm -3 serverA_files serverB_files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will run the script through cron entry per hour. So where the output of the above echo command will be printed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2011 07:27:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5411245#M640226</guid>
      <dc:creator>rahul_rtns</dc:creator>
      <dc:date>2011-12-07T07:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: script regarding ssh</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5411261#M640227</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /pathtoscript/backup.sh&lt;/P&gt;&lt;P&gt;&amp;gt;whether the script will successfully run&amp;nbsp;by typing the script as above. Or is there any other way to run the script?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know how to run your script or what parms it takes??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo "Some files not matched:"&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; comm -3 serverA_files serverB_files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;I will run the script through cron entry per hour. So where the output of the above echo command will be printed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It will be mailed to you.&amp;nbsp; I left it there in case you wanted some debugging output.&lt;/P&gt;&lt;P&gt;You could comment it out like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; :&amp;nbsp; echo "Some files not matched:"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; : comm -3 serverA_files serverB_files&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used ":" vs "#" since there must be something in the else block.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2011 07:38:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-regarding-ssh/m-p/5411261#M640227</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-12-07T07:38:06Z</dc:date>
    </item>
  </channel>
</rss>

