<?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: Run sql from a shell script in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848091#M66727</link>
    <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;emailaddr=`isql -s sdc -&amp;lt;&lt;EOF&gt;&lt;/EOF&gt;set lock mode to wait;&lt;BR /&gt;Select Unique Lower(recipient), "RCP"&lt;BR /&gt;From email_ctrl&lt;BR /&gt;Where Upper(rptType) = "POLL"&lt;BR /&gt;And Upper(hold) &amp;lt;&amp;gt; "Y"&lt;BR /&gt;EOF`&lt;BR /&gt;&lt;BR /&gt;Seems that your sql database connection is not working. You need to check return codes and stop this script when this happens.&lt;BR /&gt;&lt;BR /&gt;The return code from processes is kept in the $? variable.&lt;BR /&gt;&lt;BR /&gt;echo "steve"&lt;BR /&gt;echo $?&lt;BR /&gt;If I get a zero that means the echo steve statement was successful.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
    <pubDate>Tue, 22 Aug 2006 09:59:48 GMT</pubDate>
    <dc:creator>Steven E. Protter</dc:creator>
    <dc:date>2006-08-22T09:59:48Z</dc:date>
    <item>
      <title>Run sql from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848089#M66725</link>
      <description>I have a working script (kitpoll.sh) that runs sql to prepare for a list of recipients for an email as following:&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;echo "From: SDC" &amp;gt; /eis/data/poll.msg&lt;BR /&gt;echo "Subject: POLLING RESULTS " &amp;gt;&amp;gt;/eis/data/poll.msg&lt;BR /&gt;&lt;BR /&gt;emailaddr=`isql -s sdc -&amp;lt;&lt;EOF&gt;&lt;/EOF&gt;        set lock mode to wait;&lt;BR /&gt;        Select Unique Lower(recipient), "RCP"&lt;BR /&gt;        From email_ctrl&lt;BR /&gt;        Where Upper(rptType) = "POLL" &lt;BR /&gt;           And Upper(hold) &amp;lt;&amp;gt; "Y"&lt;BR /&gt;EOF`&lt;BR /&gt;&lt;BR /&gt;        people_cnt=0&lt;BR /&gt;        for everyone in `echo $emailaddr`&lt;BR /&gt;        do&lt;BR /&gt;            echo "To: $everyone" &amp;gt;&amp;gt; /eis/data/poll.msg&lt;BR /&gt;            people_cnt=`expr $people_cnt + 1`&lt;BR /&gt;        done&lt;BR /&gt;&lt;BR /&gt;        if  [ $people_cnt -gt 1 ]&lt;BR /&gt;        then&lt;BR /&gt;         cat /eis/data/poll.msg /eis/data/sitestat.txt | /usr/sbin/sendmail -t&lt;BR /&gt;        fi&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Randomly it failed in getting any recipients (if re-ran, it worked again!). I put the output of shell script to a log and noticed, when it was working, in the log:&lt;BR /&gt;&lt;BR /&gt;Lockmode set.&lt;BR /&gt;34 row(s) retrieved.&lt;BR /&gt;&lt;BR /&gt;When it failed, in the log:&lt;BR /&gt; kitpoll.sh[48]: /var/tmp/sh2806.1: Cannot find or open the file.&lt;BR /&gt;&lt;BR /&gt;----------------------------------------------&lt;BR /&gt;The Database engine is Informix runing on HP-UX 11.11. What can I do to make sure it works perfect?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Chushia</description>
      <pubDate>Tue, 22 Aug 2006 09:52:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848089#M66725</guid>
      <dc:creator>Chushia</dc:creator>
      <dc:date>2006-08-22T09:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Run sql from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848090#M66726</link>
      <description>I'd check /var/tmp to make sure there is plenty of room and there are inodes free. Your script is trying to create a temp file and failing.</description>
      <pubDate>Tue, 22 Aug 2006 09:59:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848090#M66726</guid>
      <dc:creator>Jonathan Fife</dc:creator>
      <dc:date>2006-08-22T09:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Run sql from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848091#M66727</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;emailaddr=`isql -s sdc -&amp;lt;&lt;EOF&gt;&lt;/EOF&gt;set lock mode to wait;&lt;BR /&gt;Select Unique Lower(recipient), "RCP"&lt;BR /&gt;From email_ctrl&lt;BR /&gt;Where Upper(rptType) = "POLL"&lt;BR /&gt;And Upper(hold) &amp;lt;&amp;gt; "Y"&lt;BR /&gt;EOF`&lt;BR /&gt;&lt;BR /&gt;Seems that your sql database connection is not working. You need to check return codes and stop this script when this happens.&lt;BR /&gt;&lt;BR /&gt;The return code from processes is kept in the $? variable.&lt;BR /&gt;&lt;BR /&gt;echo "steve"&lt;BR /&gt;echo $?&lt;BR /&gt;If I get a zero that means the echo steve statement was successful.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Tue, 22 Aug 2006 09:59:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848091#M66727</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2006-08-22T09:59:48Z</dc:date>
    </item>
    <item>
      <title>Re: Run sql from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848092#M66728</link>
      <description>/var is 2G and only 27% used. And, if re-run it worked. In syslog.log there is no error about i-node.&lt;BR /&gt;&lt;BR /&gt;As for connection, I tested that if there is sql error it'd still result in a return value of 0. Plus, the fail reason would be written in log like : Database not found or no system permission;&lt;BR /&gt;or "The specified table (email_ctrl) is not in the database."&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Chushia</description>
      <pubDate>Tue, 22 Aug 2006 10:31:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848092#M66728</guid>
      <dc:creator>Chushia</dc:creator>
      <dc:date>2006-08-22T10:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Run sql from a shell script</title>
      <link>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848093#M66729</link>
      <description>Perhaps you have a cleanup script running from your cron.daily or root's crontab that is clearing out the /var/tmp directory indiscriminately.</description>
      <pubDate>Tue, 22 Aug 2006 12:49:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/run-sql-from-a-shell-script/m-p/3848093#M66729</guid>
      <dc:creator>Jonathan Fife</dc:creator>
      <dc:date>2006-08-22T12:49:22Z</dc:date>
    </item>
  </channel>
</rss>

