Kill -9 -1 combination


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Kill -9 -1 combination
# 8  
Old 11-11-2019
Some OSes - like AIX - by default do not have a pkill command Smilie Someone might have installed it from somewhere but its not native so do not assume it exists on your host.

If you are logged in as the user med, and you want everything down that this user runs, kill -9 -1 is a pretty safe method. But only run it when the application stop script left things running. So wait a few min after stopping the app to run the command.
Please note that if you have zombie processes left over (app processes that are owned by 1), this command will still not kill them. Only a system reboot will.
If you have to restart your app often, its better to find out what is preventing your processes from terminating cleanly than to kill those leftover processes.
These 3 Users Gave Thanks to zxmaus For This Post:
# 9  
Old 11-12-2019
The OS is Linux, as stated in post #5.
Linux distros have got pgrep/pkill soon after Sun introduced them on Solaris. They were pretty welcome because the traditional Linux commands pidof/killall got distro-specific options.
Also HP-UX 11.31 got pgrep/pkill. (When will AIX tune in?)

Regarding kill, I second RudiC that you must consult the shell's man page to ensure that its kill builtin supports -1

And yes, a kill -9 is a last resort, if the only alternative is a system reboot. It might leave shared memory, semaphores, temporary files, etc. behind.
# 10  
Old 11-20-2019
Good afternoon


I used the command to kill 3004 prcesseses but it kill somme processees my own session bu processes realted to a shell called CHECK_PORT_PROCESS_MAIN.sh could get killed

Code:
pkill -u perm_adm && sleep 5 && pkill -9 -u perm_adm

Code:
root@proermpaymweb02 app]# ps -ef | grep CHECK_PORT_PROCESS_MAIN.sh | wc -l

3004

[root@proermpaymweb02 app]# ps -ef | grep CHECK_PORT_PROCESS_MAIN.sh | head -100

perm_ad+   308  8009  0 05:53 ?        00:00:00 /bin/bash /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh

perm_ad+   313  8009  0 03:31 ?        00:00:00 /bin/bash /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh

perm_ad+   326  8009  0 05:53 ?        00:00:00 /bin/bash /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh

perm_ad+   340  8009  0 03:31 ?        00:00:00 /bin/bash /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh

perm_ad+   341  8009  0 05:53 ?        00:00:00 /bin/bash /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh

perm_ad+   359  8009  0 03:32 ?        00:00:00 /bin/bash /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh

perm_ad+   375  8009  0 05:53 ?        00:00:00 /bin/bash /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh

[/CODE]

This shell runs every 5 minutes but lastly it gets stuck and fills up the server the server with a huge amount of processes most of them with CHECK_PORT_PROCESS script

So The system Administrator can not kill these processes and He/she had to Restart the server many times

I appreciate your help in advanced
# 11  
Old 11-20-2019
Looks like a broken /app/perm/backend/check_port_process/CHECK_PORT_PROCESS_MAIN.sh script.
Can you post content of that script perhaps ?

Script hangs due to some condition, one should debug it.

Hope that helps
Regards
Peasant.
# 12  
Old 11-20-2019
Give the process name! The short name is bash but with -f it takes the full name or a part of it.
Code:
pkill -u perm_adm -f CHECK_PORT_PROCESS_MAIN.sh && sleep 5 && pkill -9 -u perm_adm -f CHECK_PORT_PROCESS_MAIN.sh

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Combination of 6 nos

Hi folks, I have a numbers from 1-100 and from these nos I have 30 numbers.. From this 30 nos, I have to generate a combination of 6 nos... this 30 numbers will range from 1-100... ( FYI: This is not a lottery game - just kidding) ... I am trying out this in a shell script.. any ideas ? (3 Replies)
Discussion started by: gsiva
3 Replies

2. Programming

6 digits combination

Is there any program that can create 6 digit numbers with: (DIGIT_1)+(DIGIT_2)+(DIGIT_3)+(DIGIT_4)+(DIGIT_5)+(DIGIT_6)=10 Any perl or C also can. Anyone can help me? Thank you (6 Replies)
Discussion started by: Tzeronone
6 Replies

3. Shell Programming and Scripting

Kill an specific process ID using the KILL and GREP commands

Good afternoon I need to KILL a process in a single command sentence, for example: kill -9 `ps -aef | grep 'CAL255.4ge' | grep -v grep | awk '{print $2}'` That sentence Kills the process ID corresponding to the program CAL255.4ge. However it is possible that the same program... (6 Replies)
Discussion started by: enriquegm82
6 Replies

4. Shell Programming and Scripting

Combination of numbers

Hello Group, I have a file of data that contain 1 2 3 4 5 I request you help with a shell script for generate all posible combination of these numbers with the following output: Example: 1 + 2 + 3 + 4 + 5 = 2 + 2 + 3 + 4 + 5 = 3 + 2 + 3 + 4 + 5 = Thanks in advance. Carlos (7 Replies)
Discussion started by: csierra
7 Replies

5. Linux

Kill a process without using kill command

I want to Kill a process without using kill command as i don't have privileges to kill the process. I know the pid and i am using Linux 2.6.9 OS. (6 Replies)
Discussion started by: sudhamacs
6 Replies

6. Shell Programming and Scripting

Kill a process without using kill command

Sorry, posted the question in other forum. (0 Replies)
Discussion started by: sudhamacs
0 Replies

7. UNIX for Dummies Questions & Answers

combination of two commands

I want to show a output like this Lee Ballancore PID TTY TIME CMD 31799 pts/3 00:00:00 vim 31866 pts/3 00:00:00 vim 2495 pts/7 00:00:00 vim 8368 pts/0 00:00:00 vim 9544 pts/2 00:00:00 ps Alistairr Rutherford PID TTY TIME CMD 8368 pts/0 00:00:00 vim 9544 pts/2 00:00:00 ps ... (3 Replies)
Discussion started by: nehaquick
3 Replies

8. Programming

kill(0,-9) don't kill the process

Hi all i have simple c program , when i wish to kill the app im using kill(0,-9) , but it seams this command don't do any thing and the program. just ignore it . what im doing wrong here ? im using HP-UX ia64 Thanks (9 Replies)
Discussion started by: umen
9 Replies

9. UNIX for Advanced & Expert Users

When kill doesnt work, how to kill a process ?

Hi All, I am unable to kill a process using kill command. I am using HP-UX system. I have tried with kill -9 and i have root privilages. How can i terminate this daemon ? ? ? Regards, Vijay Hegde (3 Replies)
Discussion started by: VijayHegde
3 Replies

10. Filesystems, Disks and Memory

Partition combination

Hi all I've got MacOSX server which is a UNIX based system. I've got 2 partiontion an I like to make just one partition on he disk without loosing any data on part1. Is there a way to do that kind of thing in UNIX or do I have to format everything and put up the system again? Thanx for reading... (3 Replies)
Discussion started by: gardarm
3 Replies
Login or Register to Ask a Question