HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: script to start nis.server hung
Operating System - HP-UX
1834263
Members
87108
Online
110066
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2008 01:38 PM
12-24-2008 01:38 PM
script to start nis.server hung
Dear,
i've created a script to stop and start nis.server below.
#!/usr/bin/sh
NUM=`ps -ef |grep ypserv|wc|awk '{print $1}'`
if [ $NUM -lt 0 ]
then
exit 0
else
/sbin/init.d/nis.server stop
/sbin/init.d/nis.server start
mailx -r root@`uname -n` -s "Starting nis.server on `uname -n` `date`" tquach@xxxx.com exit 1
fi
When running this script manually,
it's alway hung at this location. but if i run from command line this line
#/sbin/init.d/nis.server stop
it's always work.
Would you Please suggest a work around for this.
test:[root]:[TWO_TASK=xxx]:/util/run
#./chkypserv.sh
stopping rpc.yppasswd
stopping rpc.ypupdated
stopping ypserv
stopping ypxfrd
Terminated
test:[root]:[TWO_TASK=xxx]:/util/run
#stopping keyserv <---hung right here
Thanks in advance.
Regards,
Tom
i've created a script to stop and start nis.server below.
#!/usr/bin/sh
NUM=`ps -ef |grep ypserv|wc|awk '{print $1}'`
if [ $NUM -lt 0 ]
then
exit 0
else
/sbin/init.d/nis.server stop
/sbin/init.d/nis.server start
mailx -r root@`uname -n` -s "Starting nis.server on `uname -n` `date`" tquach@xxxx.com exit 1
fi
When running this script manually,
it's alway hung at this location. but if i run from command line this line
#/sbin/init.d/nis.server stop
it's always work.
Would you Please suggest a work around for this.
test:[root]:[TWO_TASK=xxx]:/util/run
#./chkypserv.sh
stopping rpc.yppasswd
stopping rpc.ypupdated
stopping ypserv
stopping ypxfrd
Terminated
test:[root]:[TWO_TASK=xxx]:/util/run
#stopping keyserv <---hung right here
Thanks in advance.
Regards,
Tom
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2008 11:18 AM
12-25-2008 11:18 AM
Re: script to start nis.server hung
Ok, so what is this? "test:[root]:[TWO_TASK=xxx]:/util/run"?
Are you running this out of some kind of scheduler / monitor package?
Your script is chkypserv.sh? Add "set -x" to it and run it from the command line and log the output.
Make sure you don't have issues with "@" being the "kill" character.
FUll path to mailx?
Line wrap in the mailx command line or is it continued with "\"?
I don't haves access to the nis.server script, does it even look at "ketsvr"?
Why "exit 1"?
Are you running this out of some kind of scheduler / monitor package?
Your script is chkypserv.sh? Add "set -x" to it and run it from the command line and log the output.
Make sure you don't have issues with "@" being the "kill" character.
FUll path to mailx?
Line wrap in the mailx command line or is it continued with "\"?
I don't haves access to the nis.server script, does it even look at "ketsvr"?
Why "exit 1"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2008 02:31 PM
12-25-2008 02:31 PM
Re: script to start nis.server hung
> NUM=`ps -ef |grep ypserv|wc|awk '{print $1}'`
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:
UNIX95=1 ps -C ypserv > /dev/null 2>&1
[ $# -ne 0 ] && exit 0
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.
Use this technique to find processes by name and dump ps+grep.
Bill Hassell, sysadmin
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:
UNIX95=1 ps -C ypserv > /dev/null 2>&1
[ $# -ne 0 ] && exit 0
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.
Use this technique to find processes by name and dump ps+grep.
Bill Hassell, sysadmin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP