<?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: su from cron in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284427#M641532</link>
    <description>See above, opps.</description>
    <pubDate>Tue, 14 Jun 2011 18:15:29 GMT</pubDate>
    <dc:creator>P-Dicky</dc:creator>
    <dc:date>2011-06-14T18:15:29Z</dc:date>
    <item>
      <title>su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284414#M641519</link>
      <description>Hi &lt;BR /&gt;I'm trying this from root cron &lt;BR /&gt;50 * * * * "su - wmsusr -c /wms/app/zabbix/check_zabbix.sh"&lt;BR /&gt;&lt;BR /&gt;Works fine if I &lt;BR /&gt;# su - wmsusr&lt;BR /&gt;]: /wms/app/zabbix/check_zabbix.sh&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;3&lt;BR /&gt;4&lt;BR /&gt;5&lt;BR /&gt;wmsusr@prodomni ksh[392]:&lt;BR /&gt;&lt;BR /&gt;Here is the script &lt;BR /&gt;HOSTNAME=`whoami`&lt;BR /&gt;echo 1&lt;BR /&gt;value=`ps -fu $HOSTNAME |grep zabbix| grep -v grep| wc -l`&lt;BR /&gt;echo 2&lt;BR /&gt;if [ $value -eq 0 ]; then&lt;BR /&gt;echo 3&lt;BR /&gt;        rm -f /wms/app/zabbix/agentd.pid&lt;BR /&gt;echo 4&lt;BR /&gt;        /wms/app/zabbix/zabbix_agentd -c /wms/app/zabbix/zabbix_agentd.conf&lt;BR /&gt;echo 5&lt;BR /&gt;fi&lt;BR /&gt;exit 0;&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Jun 2011 18:31:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284414#M641519</guid>
      <dc:creator>P-Dicky</dc:creator>
      <dc:date>2011-06-09T18:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284415#M641520</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;What does the '/var/adm/cron/log' show; particularly the return code (rc=)?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 09 Jun 2011 18:48:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284415#M641520</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-09T18:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284416#M641521</link>
      <description>I should mention if I run &lt;BR /&gt;# su - wmsusr -c /wms/app/zabbix/check_zabbix.sh&lt;BR /&gt;from root prompt I get this &lt;BR /&gt;&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;logout&lt;BR /&gt;#&lt;BR /&gt;</description>
      <pubDate>Thu, 09 Jun 2011 18:49:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284416#M641521</guid>
      <dc:creator>P-Dicky</dc:creator>
      <dc:date>2011-06-09T18:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284417#M641522</link>
      <description>you are trying to check if zabbix agent is running as wmsusr, if not remove the pid and start zabbix agent.&lt;BR /&gt;&lt;BR /&gt;your second output ran as root, did you stop the agent before running the script?  If the agent is running, you will see only 1 and 2 right?</description>
      <pubDate>Thu, 09 Jun 2011 20:02:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284417#M641522</guid>
      <dc:creator>Wilfred Chau_1</dc:creator>
      <dc:date>2011-06-09T20:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284418#M641523</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;I believe Wilfred may have found the reason.&lt;BR /&gt;&lt;BR /&gt;You really ought to change the *name* of the variable that holds the *user* id.  Calling the variable "HOSTNAME" is rather misleading :-)&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 09 Jun 2011 20:33:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284418#M641523</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-09T20:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284419#M641524</link>
      <description>&amp;gt;value=`ps -fu $HOSTNAME | grep zabbix| grep -v grep | wc -l`&lt;BR /&gt;&lt;BR /&gt;You may want to list what $HOSTNAME and  "ps -fu $HOSTNAME" shows so you can make sure what you are looking for.</description>
      <pubDate>Fri, 10 Jun 2011 04:54:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284419#M641524</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2011-06-10T04:54:40Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284420#M641525</link>
      <description>Hi All... &lt;BR /&gt;&lt;BR /&gt;Hostname is a bad var name but I don't see how it causes the problem... The agent is not running when I'm running the script and from root &lt;BR /&gt;&lt;BR /&gt;su - wmsusr -c /wms/app/zabbix/check_zabbix.sh&lt;BR /&gt;&lt;BR /&gt;Results&lt;BR /&gt;~/.kshrc&lt;BR /&gt;&lt;BR /&gt;1&lt;BR /&gt;2&lt;BR /&gt;logout&lt;BR /&gt;&lt;BR /&gt;Any ideas? THANKS!</description>
      <pubDate>Tue, 14 Jun 2011 11:33:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284420#M641525</guid>
      <dc:creator>P-Dicky</dc:creator>
      <dc:date>2011-06-14T11:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284421#M641526</link>
      <description>Just to confirm again... If I su to wmsusr and then run all is fine... Just when I'm calling from roots cron and trying to su to that user do I have an issue.</description>
      <pubDate>Tue, 14 Jun 2011 11:36:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284421#M641526</guid>
      <dc:creator>P-Dicky</dc:creator>
      <dc:date>2011-06-14T11:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284422#M641527</link>
      <description>HI (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; If I su to wmsusr and then run all is fine... Just when I'm calling from roots cron and trying to su to that user do I have an issue.&lt;BR /&gt;&lt;BR /&gt;Why do you 'cron' this as 'root' if you then switch to the 'wmsusr'?  &lt;BR /&gt;&lt;BR /&gt;What happens if you 'cron' this task as the 'wmsuer' ?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 14 Jun 2011 12:10:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284422#M641527</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-14T12:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284423#M641528</link>
      <description>Right now only root user has cron and because of service guard they just want one crontab to maintain... Small IT group.</description>
      <pubDate>Tue, 14 Jun 2011 12:11:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284423#M641528</guid>
      <dc:creator>P-Dicky</dc:creator>
      <dc:date>2011-06-14T12:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284424#M641529</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Right now only root user has cron and because of service guard they just want one crontab to maintain... Small IT group.&lt;BR /&gt;&lt;BR /&gt;Regardless, would you humor us and try running as a crontask of 'wmsusr' (without the need to 'su')?&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Hostname is a bad var name but I don't see how it causes the problem&lt;BR /&gt;&lt;BR /&gt;Of course not.  I merely was pointing out that when you ask someone to look at your code, it always helps to have used *meaningful* variable names.  You wouldn't show me an orange and tell me that the apple you have is rotten, would you?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 14 Jun 2011 12:31:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284424#M641529</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2011-06-14T12:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284425#M641530</link>
      <description>what is the result, if you do not invoking a login shell? i.e.&lt;BR /&gt;&lt;BR /&gt;50 * * * * "su wmsusr -c /wms/app/zabbix/check_zabbix.sh"</description>
      <pubDate>Tue, 14 Jun 2011 16:58:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284425#M641530</guid>
      <dc:creator>Wilfred Chau_1</dc:creator>
      <dc:date>2011-06-14T16:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284426#M641531</link>
      <description>Hi All... I just moved the su into the script and it is fine now... &lt;BR /&gt;echo 4&lt;BR /&gt;su - wmsusr -c "/wms/app/zabbix/zabbix_agentd -c /wms/app/zabbix/zabbix_agentd.conf"&lt;BR /&gt;echo 5&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Jun 2011 18:13:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284426#M641531</guid>
      <dc:creator>P-Dicky</dc:creator>
      <dc:date>2011-06-14T18:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: su from cron</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284427#M641532</link>
      <description>See above, opps.</description>
      <pubDate>Tue, 14 Jun 2011 18:15:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/su-from-cron/m-p/5284427#M641532</guid>
      <dc:creator>P-Dicky</dc:creator>
      <dc:date>2011-06-14T18:15:29Z</dc:date>
    </item>
  </channel>
</rss>

