- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Script to find process and kill
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
тАО09-20-2010 06:43 AM
тАО09-20-2010 06:43 AM
Script to find process and kill
then kill the process.
Any help would be very greatful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2010 06:50 AM
тАО09-20-2010 06:50 AM
Re: Script to find process and kill
kill `ps -ef |grep "MIA.OFS" |grep bnk`
# that would be an orderly kill, if it doesn't work, try again, more forcefully
kill -9 `ps -ef |grep "MIA.OFS" |grep bnk`
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2010 07:01 AM
тАО09-20-2010 07:01 AM
Re: Script to find process and kill
Don't use 'grep' as this can lead to erroneous matches!
Do something like this to match 'MIA.OFS' exactly and only if the running user is "bnk":
# kill $(UNIX95= ps -C MIA.OFS -opid= -ouser=|awk '$2=="bnk" {print $1}')
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2010 07:15 AM
тАО09-20-2010 07:15 AM
Re: Script to find process and kill
If you are running 11.31, you could use 'pkill' as :
# pkill MIA.OFS -u bnk
In either case, there is an advantage to capturing the pid or pids that match. For example:
# PIDS=$(UNIX95= ps -C MIA.OFS -opid= -ouser=|awk '$2=="bnk" {print $1}')
...then allows a "kind" kill:
# kill ${PIDS}
...which can be escalated if necessary:
# if [ ! -z "${PIDS}" ]; then
> kill -1 ${PIDS}
> kill -15 ${PIDS} 2>/dev/null
> kill -9 ${PIDS} 2>/dev/null
> fi
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-20-2010 09:52 AM
тАО09-20-2010 09:52 AM