<?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 help needed in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898763#M104491</link>
    <description>It's interesting that the order of the commands seems to be reversed in the cron example - is that actually how it appears?&lt;BR /&gt;&lt;BR /&gt;Pursuing the no such file or directory angle, this seems to be coming from the mc command, and the only file mc uses is /dev/scsi/3.&lt;BR /&gt;&lt;BR /&gt;Try adding /dev/scsi into your PATH.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
    <pubDate>Thu, 06 Feb 2003 19:07:31 GMT</pubDate>
    <dc:creator>Pete Randall</dc:creator>
    <dc:date>2003-02-06T19:07:31Z</dc:date>
    <item>
      <title>Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898756#M104484</link>
      <description>Hi all,&lt;BR /&gt;&lt;BR /&gt;I am running the following script from cron:&lt;BR /&gt;&lt;BR /&gt;set -x&lt;BR /&gt;host=`hostname`&lt;BR /&gt;if [ $host = "db05461" -o $host = "dbumegan" ]&lt;BR /&gt;then&lt;BR /&gt;        tapeid=`/usr/sbin/mc -r DS | grep DT_slot_1 | awk '{print $3}'`&lt;BR /&gt;fi&lt;BR /&gt;echo $tapeid&lt;BR /&gt;&lt;BR /&gt;Here is the data that the script is looking at:&lt;BR /&gt;&lt;BR /&gt;#mc -r DS&lt;BR /&gt;DT_slot_1 FULL W2T004&lt;BR /&gt;DT_slot_2 EMPTY&lt;BR /&gt;ST_slot_1 FULL W2T001&lt;BR /&gt;ST_slot_2 FULL W2T002&lt;BR /&gt;ST_slot_3 FULL W2T003&lt;BR /&gt;ST_slot_4 FULL W2T004&lt;BR /&gt;ST_slot_5 FULL W2T005&lt;BR /&gt;ST_slot_6 FULL W2T001&lt;BR /&gt;ST_slot_7 FULL W2T002&lt;BR /&gt;ST_slot_8 FULL W2T003&lt;BR /&gt;ST_slot_9 EMPTY&lt;BR /&gt;ST_slot_10 FULL W2T005&lt;BR /&gt;ST_slot_11 FULL W2T001&lt;BR /&gt;ST_slot_12 FULL W2T002&lt;BR /&gt;ST_slot_13 FULL W2T003&lt;BR /&gt;ST_slot_14 FULL W2T004&lt;BR /&gt;ST_slot_15 FULL W2T005&lt;BR /&gt;ST_slot_16 EMPTY&lt;BR /&gt;ST_slot_17 EMPTY&lt;BR /&gt;ST_slot_18 EMPTY&lt;BR /&gt;ST_slot_19 EMPTY&lt;BR /&gt;&lt;BR /&gt;Now here is the problem.  If I run the script manually from a prompt, it works correctly and tapeid gets the correct value (W2T004).&lt;BR /&gt;&lt;BR /&gt;+ + hostname&lt;BR /&gt;host=db05461&lt;BR /&gt;+ [ db05461 = db05461 -o db05461 = dbumegan ]&lt;BR /&gt;+ + /usr/sbin/mc -r DS&lt;BR /&gt;+ awk {print $3}&lt;BR /&gt;+ grep DT_slot_1&lt;BR /&gt;tapeid=W2T004&lt;BR /&gt;+ echo W2T004&lt;BR /&gt;W2T004&lt;BR /&gt;&lt;BR /&gt;When I run from cron, the script gives me the following error in the log file (tapeid gets no value):&lt;BR /&gt;&lt;BR /&gt;+ + hostname&lt;BR /&gt;host=db05461&lt;BR /&gt;+ [ db05461 = db05461 -o db05461 = dbumegan ]&lt;BR /&gt;+ + grep DT_slot_1&lt;BR /&gt;+ awk {print $3}&lt;BR /&gt;+ /usr/sbin/mc -r DS&lt;BR /&gt;ERROR: No such file or directory&lt;BR /&gt;tapeid=&lt;BR /&gt;+ echo&lt;BR /&gt;&lt;BR /&gt;I am completely stumped.  What is going wrong?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Thu, 06 Feb 2003 18:39:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898756#M104484</guid>
      <dc:creator>Craig A. Sharp</dc:creator>
      <dc:date>2003-02-06T18:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898757#M104485</link>
      <description>The first line of commands (After the #!/usr/bin/sh) should be '. /.profile'. (Or whatever profile for the user you are running it as!)&lt;BR /&gt;&lt;BR /&gt;'mc' command must require something set inside either the PATH or environment variables, which 'cron' will not do by default.&lt;BR /&gt;&lt;BR /&gt;Share and Enjoy! Ian&lt;BR /&gt;</description>
      <pubDate>Thu, 06 Feb 2003 18:44:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898757#M104485</guid>
      <dc:creator>Ian Dennison_1</dc:creator>
      <dc:date>2003-02-06T18:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898758#M104486</link>
      <description>While running from cron are you giving entire path? If not try it in that way.&lt;BR /&gt;It's probably because the PATH variable is not set in the cronjob&lt;BR /&gt;&lt;BR /&gt;-USA..</description>
      <pubDate>Thu, 06 Feb 2003 18:44:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898758#M104486</guid>
      <dc:creator>Uday_S_Ankolekar</dc:creator>
      <dc:date>2003-02-06T18:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898759#M104487</link>
      <description>add PATH=PATH:/usr/bin to your script &lt;BR /&gt;&lt;BR /&gt;and try running in cron again.&lt;BR /&gt;&lt;BR /&gt;cron didn't use profile and hence may not have all the paths available.</description>
      <pubDate>Thu, 06 Feb 2003 18:52:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898759#M104487</guid>
      <dc:creator>Wilfred Chau_1</dc:creator>
      <dc:date>2003-02-06T18:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898760#M104488</link>
      <description>export PATH=$PATH:/usr/bin might be better.  Better yet, try&lt;BR /&gt;&lt;BR /&gt;export PATH=`cat /etc/PATH`&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 06 Feb 2003 18:58:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898760#M104488</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-06T18:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898761#M104489</link>
      <description>when writing scripts for cron or remote execution always set the PATH var or fully path ever command&lt;BR /&gt;mean instead of grep do /usr/bin/grep and for awk /usr/bin/awk&lt;BR /&gt;&lt;BR /&gt;if you do not know the run path for a command use the whereis command&lt;BR /&gt;example&lt;BR /&gt;whereis awk&lt;BR /&gt;awk: /sbin/awk /usr/bin/awk /usr/share/man/man1.Z/awk.1</description>
      <pubDate>Thu, 06 Feb 2003 19:01:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898761#M104489</guid>
      <dc:creator>James Odak</dc:creator>
      <dc:date>2003-02-06T19:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898762#M104490</link>
      <description>Hi Craig:&lt;BR /&gt;&lt;BR /&gt;I need to add the option "-p /dev/rac/c2t0d0" to the mc command to get the output you are showing.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;&lt;BR /&gt;Tom</description>
      <pubDate>Thu, 06 Feb 2003 19:03:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898762#M104490</guid>
      <dc:creator>Tom Jackson</dc:creator>
      <dc:date>2003-02-06T19:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898763#M104491</link>
      <description>It's interesting that the order of the commands seems to be reversed in the cron example - is that actually how it appears?&lt;BR /&gt;&lt;BR /&gt;Pursuing the no such file or directory angle, this seems to be coming from the mc command, and the only file mc uses is /dev/scsi/3.&lt;BR /&gt;&lt;BR /&gt;Try adding /dev/scsi into your PATH.&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Thu, 06 Feb 2003 19:07:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898763#M104491</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-02-06T19:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script help needed</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898764#M104492</link>
      <description>Got it!&lt;BR /&gt;&lt;BR /&gt;The fix was the -p switch in the mc command.&lt;BR /&gt;&lt;BR /&gt;Thanks to all for your excellent replies.&lt;BR /&gt;&lt;BR /&gt;Craig</description>
      <pubDate>Thu, 06 Feb 2003 19:38:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-help-needed/m-p/2898764#M104492</guid>
      <dc:creator>Craig A. Sharp</dc:creator>
      <dc:date>2003-02-06T19:38:14Z</dc:date>
    </item>
  </channel>
</rss>

