<?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 Variables in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995053#M718482</link>
    <description>The others recommended a couple of good ways to answer your question.  But let me point out that ping is not necessarily a good way to determine whether or not a networked device is available.  I've had LOTS of circumstances where a completely hosed computer still responded to a ping.  This is because ping is ICMP, and is a low-level utility.  It merely means that the network card is working, not necessarily that the device it is attached to is up.  &lt;BR /&gt;For that purpose, use something that actually does something on the remote host.  We use secure shell here, and you should too.  Here's why: &lt;BR /&gt;ssh $HOST "ls -l /etc/hosts"&lt;BR /&gt;if test "$?" -ne "0"&lt;BR /&gt;then&lt;BR /&gt;print "Houston, we have a problem on $HOST"&lt;BR /&gt;fi&lt;BR /&gt;Every morning at 8 AM, I have a cron job that iterates through a miniature HOSTS table and pretty much does the above. This gives management a warm fuzzy feeling that each host has been checked, and is up and running.  A ping all by itself won't do that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
    <pubDate>Wed, 11 Jun 2003 18:46:50 GMT</pubDate>
    <dc:creator>Chris Vail</dc:creator>
    <dc:date>2003-06-11T18:46:50Z</dc:date>
    <item>
      <title>Script Variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995048#M718477</link>
      <description>I am trying to write a script that will run from the cron to check (ping) some network devices.  &lt;BR /&gt;&lt;BR /&gt;What I really need to know is how to write a variable off to a file or the environent so I can reference that same variable the next time the script runs from cron.  &lt;BR /&gt;&lt;BR /&gt;Thanks, &lt;BR /&gt;&lt;BR /&gt;Jeff</description>
      <pubDate>Wed, 11 Jun 2003 18:18:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995048#M718477</guid>
      <dc:creator>Jeff Martin_3</dc:creator>
      <dc:date>2003-06-11T18:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Script Variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995049#M718478</link>
      <description>Hi Jeff,&lt;BR /&gt;&lt;BR /&gt;One way to do it would be to write the variable to a file, and then use the dot command to source in that file at the start of your script.  You could do something like this:&lt;BR /&gt;&lt;BR /&gt;MYVAR=something &lt;BR /&gt;&lt;BR /&gt;echo "MYVAR=${MYVAR}" &amp;gt;mysrc&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And then at the beginning of your script do:&lt;BR /&gt;&lt;BR /&gt;. mysrc&lt;BR /&gt;&lt;BR /&gt;There are probably better ways to do it but that one comes to mind first.&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Wed, 11 Jun 2003 18:21:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995049#M718478</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-06-11T18:21:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script Variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995050#M718479</link>
      <description>more list | while read x #list is the file to read from&lt;BR /&gt;do&lt;BR /&gt;       ping -n 4 $x      #command to execute on list elements&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;the file "list" would contain a &lt;BR /&gt;list of devices you wanted to ping</description>
      <pubDate>Wed, 11 Jun 2003 18:25:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995050#M718479</guid>
      <dc:creator>Paul Sperry</dc:creator>
      <dc:date>2003-06-11T18:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Script Variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995051#M718480</link>
      <description>Hello!&lt;BR /&gt;&lt;BR /&gt;You can make some file that will be&lt;BR /&gt;the configuration file and inside write on/off&lt;BR /&gt;let say : /etc/your-file.conf&lt;BR /&gt;&lt;BR /&gt;Write inside on/off what you need and&lt;BR /&gt;is your script made cat to the file and&lt;BR /&gt;check if you get "on" or "off"&lt;BR /&gt;and work as you need to what you had.&lt;BR /&gt;&lt;BR /&gt;Caesar</description>
      <pubDate>Wed, 11 Jun 2003 18:29:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995051#M718480</guid>
      <dc:creator>Caesar_3</dc:creator>
      <dc:date>2003-06-11T18:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Script Variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995052#M718481</link>
      <description>Hi Jeff:&lt;BR /&gt;&lt;BR /&gt;Write your variable to a temporary file.  To retrieve it read the temporary file into a variable.  Thus:&lt;BR /&gt;&lt;BR /&gt;# FILE=/tmp/myfile&lt;BR /&gt;# echo 48 &amp;gt; ${FILE}&lt;BR /&gt;...&lt;BR /&gt;[ -r ${FILE} ] &amp;amp;&amp;amp; VAR=`&amp;lt; ${FILE}&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;The construct VAR=`&amp;lt; ${FILE}` is a very efficient method of reading a file into a variable.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 11 Jun 2003 18:33:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995052#M718481</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-06-11T18:33:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script Variables</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995053#M718482</link>
      <description>The others recommended a couple of good ways to answer your question.  But let me point out that ping is not necessarily a good way to determine whether or not a networked device is available.  I've had LOTS of circumstances where a completely hosed computer still responded to a ping.  This is because ping is ICMP, and is a low-level utility.  It merely means that the network card is working, not necessarily that the device it is attached to is up.  &lt;BR /&gt;For that purpose, use something that actually does something on the remote host.  We use secure shell here, and you should too.  Here's why: &lt;BR /&gt;ssh $HOST "ls -l /etc/hosts"&lt;BR /&gt;if test "$?" -ne "0"&lt;BR /&gt;then&lt;BR /&gt;print "Houston, we have a problem on $HOST"&lt;BR /&gt;fi&lt;BR /&gt;Every morning at 8 AM, I have a cron job that iterates through a miniature HOSTS table and pretty much does the above. This gives management a warm fuzzy feeling that each host has been checked, and is up and running.  A ping all by itself won't do that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 11 Jun 2003 18:46:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-variables/m-p/2995053#M718482</guid>
      <dc:creator>Chris Vail</dc:creator>
      <dc:date>2003-06-11T18:46:50Z</dc:date>
    </item>
  </channel>
</rss>

