- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Something weird using a kill on HP-UX 11
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО11-10-2003 07:31 PM
тАО11-10-2003 07:31 PM
I am somewhat at a loss at the reaction of HP-UX to one of the scripts we use here.
Basically, what happens is that 3 processes (AEFUF, AEFAD, AEFSECEX) and maybe some child processes are identified and killed by a script using kill -9 $PROCESS_ID (for details see attachment).
99,9% of the time the script runs smoothly, but occasionally, a message is returned saying : " usage: kill [ -signo ] pid ..."
I tried to reproduce this output of kill on the commandline;
ommitting the process id will get you the message " kill: 7737: The specified process does not exist." and ommitting everyting does " su: kill: The number of parameters specified is not correct."
But ... if I call /usr/bin/kill directly it says "Usage: kill [-signo] pid ... "
To further confuse you guys, look at the following command line snippet:
hp27:/vba/acc/nb/lat/lat_01/command_library [154] > which kill
/usr/bin/kill
hp27:/vba/acc/nb/lat/lat_01/command_library [155] > /usr/bin/kill
usage: kill [ -signo ] pid ...
hp27:/vba/acc/nb/lat/lat_01/command_library [156] > kill
su: kill: The number of parameters specified is not correct.
So I use /usr/bin/kill, but if I call the /usr/bin/kill directly i get another /usr/bin/kill than via the normal kill which also goes to /usr/bin/kill?
Does this make sense at all?
Or do I better apply for a job as counter clerk at McDonalds?
Thanks in advance for all your help,
DJ
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2003 07:38 PM
тАО11-10-2003 07:38 PM
Re: Something weird using a kill on HP-UX 11
If your script is using the bourne shell, it is worth noting that it doesn't have a built in "kill" and so you would be using the command version
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2003 07:41 PM
тАО11-10-2003 07:41 PM
SolutionIt would appear that at times your script doesn't get an existing PID is it possible that the script is trying to kill a process that exisited when the script started but had terminated by the time you got to the killing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2003 08:12 PM
тАО11-10-2003 08:12 PM
Re: Something weird using a kill on HP-UX 11
the error message may also be caused by an illegal pid number, i.e. >30000, or if the pid contains characters.
Perhaps you could let your script write out the pid to the logfile as well.
Just a suggestion....
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2003 08:12 PM
тАО11-10-2003 08:12 PM
Re: Something weird using a kill on HP-UX 11
I did not know the which information would not take into account the shell built-ins, so that was the initial reason of my confusion.
And you were right about the absence of the PID, I noticed a typo in the variable which is used for killing the child processes. Only occurs 0.1% of the time, so that would also account for my 99,9% being correct.
Again thanks alot for your quick response.
Cheers,
DJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-10-2003 11:17 PM
тАО11-10-2003 11:17 PM
Re: Something weird using a kill on HP-UX 11
Just a note that one should only use kill -9 as a last resort because a -9 kill will do no cleanup of shared memory or semaphores & such. Therefore over time all these uncollected resources could cause shortages & force you to manually cleanup or even reboot to continue.
Always use a vanilla kill or the equivalent kill -15 & then if that doesn't work you can proceed towards kill -9 trying some of the other signals along the way.
My 2 cents,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2003 12:46 AM
тАО11-11-2003 12:46 AM
Re: Something weird using a kill on HP-UX 11
To see why this is so important, try the following:
cd $HOME
echo "echo Big mistake!" > su
chmod 755 su
PATH=::$PATH
su
whereis su
type su
(where did your su come from?) Then remove su and fix PATH:
rm su
PATH=$(cat /etc/PATH)
Some other surprises:
whereis fc history for
which fc history for
type fc history for
The reason that whereis and which don't work is that they are not part of the shell, they are external commands. They know nothing about what the shell will do with a command. The whence command (for POSIX shells) interprets the command string and returns how the shell will treat the string which is what counts. The command may be a shell builtin, or an alias, or located in some unexpected PATH location. That's why all scripts should replace $PATH with an internal PATH value known to be correct (PATH=/usr/bin, *not* PATH=$PATH:other_stuff). A shell script can easily be subverted if PATH is used from the user's environment and assumed to be safe.
As far as kill failing, you should always assume that your PID number is not a number at all, that is is null or that it contains several numbers and bail out before doing something wrong. And as mentioned, kill -9 is dangerous to the health of your system. Always use kill -15 first, give the program a chance to terminate, then use kill -9 as a last resort. All sane programs should respond to kill -15 and terminate properly. kill -9 bypasses all the shutdown code in the program and simply removes the program leaving shared memory in shambles and unposted data disappears.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2003 08:25 PM
тАО11-11-2003 08:25 PM
Re: Something weird using a kill on HP-UX 11
thank you for replying!
Unix is really a very strong and fun operating system as you can reach your goal in a number of different ways - or at least it seems until you stumble onto the minor differences like with the whence/whereis/which/type commands.
It is really good that you guys want to invest your time in helping us out! I appreciate it very much, as do a lot of other people I think.
As for the kill, the script was developped by an expert who indicated that the processes can only be shut down in this manner, thus calling for the 'kill -9 ' option. The processes are alledgedly a little bit buggy in terminating themselves, and could hang if you ask them to commit suicide (kill -15).
We have been running this script for over a year now on HP-UX10, and the last half year on HP-UX11, and surprisingly we have had no resource contingencies during that time.
I think there are also kernel routines collecting garbage, so maybe the "garbagemen" took care of this issue.
But I agree that a 'kill -15' is a nicer option whenever applicable.
Again thanks for all your help,
Cheers,
DJ