<?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 to start nis.server hung in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-start-nis-server-hung/m-p/4328653#M341722</link>
    <description>&amp;gt; NUM=`ps -ef |grep ypserv|wc|awk '{print $1}'`&lt;BR /&gt; &lt;BR /&gt;This is a very unreliable way to locate a program by name. grep and ps are a very unstable combination because grep does not look where you want it too. If you run ps -ef|grep ypserv several times, you'll find that grep finds grep -- giving you a false positive. The code is much more reliable using the -C option in ps, like this:&lt;BR /&gt; &lt;BR /&gt;UNIX95=1 ps -C ypserv &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;[ $# -ne 0 ] &amp;amp;&amp;amp; exit 0&lt;BR /&gt; &lt;BR /&gt;To explain: UNIX95=1 sets a temporary variable for ps to use extra options, namely -C. Always place it on the same line as ps because setting UNIX95 for the environment will cause other unexpected changes. The return code from ps will be zero when one or more processes are found, non-zero when nothing is found. See the man page for ps for a lot of very useful values.&lt;BR /&gt; &lt;BR /&gt;Use this technique to find processes by name and dump ps+grep.</description>
    <pubDate>Thu, 25 Dec 2008 22:31:33 GMT</pubDate>
    <dc:creator>Bill Hassell</dc:creator>
    <dc:date>2008-12-25T22:31:33Z</dc:date>
    <item>
      <title>script to start nis.server hung</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-start-nis-server-hung/m-p/4328651#M341720</link>
      <description>Dear,&lt;BR /&gt;i've created a script to stop and start nis.server below.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;&lt;BR /&gt;NUM=`ps -ef |grep ypserv|wc|awk '{print $1}'`&lt;BR /&gt;&lt;BR /&gt;if [ $NUM -lt 0 ]&lt;BR /&gt;   then&lt;BR /&gt;    exit 0&lt;BR /&gt;else&lt;BR /&gt;      /sbin/init.d/nis.server stop&lt;BR /&gt;      /sbin/init.d/nis.server start&lt;BR /&gt;mailx -r root@`uname -n`  -s "Starting nis.server on `uname -n` `date`" tquach@xxxx.com      exit 1&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;When running this script manually,&lt;BR /&gt;it's alway hung at this location. but if i run from command line this line&lt;BR /&gt;#/sbin/init.d/nis.server stop&lt;BR /&gt;it's always work.&lt;BR /&gt;&lt;BR /&gt;Would you Please suggest a work around for this.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;test:[root]:[TWO_TASK=xxx]:/util/run&lt;BR /&gt;#./chkypserv.sh&lt;BR /&gt;stopping rpc.yppasswd&lt;BR /&gt;stopping rpc.ypupdated&lt;BR /&gt;stopping ypserv&lt;BR /&gt;stopping ypxfrd&lt;BR /&gt;Terminated&lt;BR /&gt;test:[root]:[TWO_TASK=xxx]:/util/run&lt;BR /&gt;#stopping keyserv &amp;lt;---hung right here&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;Regards,&lt;BR /&gt;Tom&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Dec 2008 21:38:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-start-nis-server-hung/m-p/4328651#M341720</guid>
      <dc:creator>tom quach_1</dc:creator>
      <dc:date>2008-12-24T21:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: script to start nis.server hung</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-start-nis-server-hung/m-p/4328652#M341721</link>
      <description>Ok, so what is this? "test:[root]:[TWO_TASK=xxx]:/util/run"?  &lt;BR /&gt;&lt;BR /&gt;Are you running this out of some kind of scheduler / monitor package?&lt;BR /&gt;&lt;BR /&gt;Your script is chkypserv.sh?  Add "set -x" to it and run it from the command line and log the output.&lt;BR /&gt;&lt;BR /&gt;Make sure you don't have issues with "@" being the "kill" character.&lt;BR /&gt;&lt;BR /&gt;FUll path to mailx?&lt;BR /&gt;&lt;BR /&gt;Line wrap in the mailx command line or is it continued with "\"?&lt;BR /&gt;&lt;BR /&gt;I don't haves access to the nis.server script, does it even look at "ketsvr"? &lt;BR /&gt;Why "exit 1"?</description>
      <pubDate>Thu, 25 Dec 2008 19:18:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-start-nis-server-hung/m-p/4328652#M341721</guid>
      <dc:creator>OldSchool</dc:creator>
      <dc:date>2008-12-25T19:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: script to start nis.server hung</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-to-start-nis-server-hung/m-p/4328653#M341722</link>
      <description>&amp;gt; NUM=`ps -ef |grep ypserv|wc|awk '{print $1}'`&lt;BR /&gt; &lt;BR /&gt;This is a very unreliable way to locate a program by name. grep and ps are a very unstable combination because grep does not look where you want it too. If you run ps -ef|grep ypserv several times, you'll find that grep finds grep -- giving you a false positive. The code is much more reliable using the -C option in ps, like this:&lt;BR /&gt; &lt;BR /&gt;UNIX95=1 ps -C ypserv &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&lt;BR /&gt;[ $# -ne 0 ] &amp;amp;&amp;amp; exit 0&lt;BR /&gt; &lt;BR /&gt;To explain: UNIX95=1 sets a temporary variable for ps to use extra options, namely -C. Always place it on the same line as ps because setting UNIX95 for the environment will cause other unexpected changes. The return code from ps will be zero when one or more processes are found, non-zero when nothing is found. See the man page for ps for a lot of very useful values.&lt;BR /&gt; &lt;BR /&gt;Use this technique to find processes by name and dump ps+grep.</description>
      <pubDate>Thu, 25 Dec 2008 22:31:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-to-start-nis-server-hung/m-p/4328653#M341722</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2008-12-25T22:31:33Z</dc:date>
    </item>
  </channel>
</rss>

