- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- KILL PROCESS
Operating System - HP-UX
1819931
Members
3129
Online
109607
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
Discussions
Discussions
Discussions
Forums
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
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
тАО04-29-2005 04:50 AM
тАО04-29-2005 04:50 AM
KILL PROCESS
HI,
I need make a shell for kill two process for PID in my system but i dont know if the command awk is possible.
Do you have any example for this
May you help me?
Thank you
I need make a shell for kill two process for PID in my system but i dont know if the command awk is possible.
Do you have any example for this
May you help me?
Thank you
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2005 05:05 AM
тАО04-29-2005 05:05 AM
Re: KILL PROCESS
Yes...
kill `ps -ef |grep process |awk '{print $2}'`
Or use UNIX95:
http://www.interex.org/pubcontent/enterprise/nov01/qabh1101.jsp
Bill's Q&A from Interex...near the bottom is a script...
Rgds..Geoff
kill `ps -ef |grep process |awk '{print $2}'`
Or use UNIX95:
http://www.interex.org/pubcontent/enterprise/nov01/qabh1101.jsp
Bill's Q&A from Interex...near the bottom is a script...
Rgds..Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2005 06:09 AM
тАО04-29-2005 06:09 AM
Re: KILL PROCESS
One problem with:
kill `ps -ef |grep process |awk '{print $2}'`
is, this will kill all processes that has the word
"process" in it's "ps -ef" output. This means, if you
are trying to kill a process named "roo", you will end
of killing all the root processes :-)
A better solution is:
# kill $(ps -e | grep " process$" | awk '{print $1}')
Note the black space in " process$" search string.
- Biswajit
kill `ps -ef |grep process |awk '{print $2}'`
is, this will kill all processes that has the word
"process" in it's "ps -ef" output. This means, if you
are trying to kill a process named "roo", you will end
of killing all the root processes :-)
A better solution is:
# kill $(ps -e | grep " process$" | awk '{print $1}')
Note the black space in " process$" search string.
- Biswajit
:-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-30-2005 06:32 AM
тАО04-30-2005 06:32 AM
Re: KILL PROCESS
Actually, there is no better solution than to let ps find your processes by name. ps and grep is a very unstable way to locate processes by name because grep does not know where the process name is located and does a simple string match. The UNIX95 option will not only enable the -C option but also allow you to show just the fields you need for your script.
But we need additional information. Do you know the names of the two processes? Are these names the same or different? Will there always be exactly two of these processes or will there be one or many more?
Bill Hassell, sysadmin
But we need additional information. Do you know the names of the two processes? Are these names the same or different? Will there always be exactly two of these processes or will there be one or many more?
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
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP