killing a process pid


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users killing a process pid
# 8  
Old 12-01-2006
.............

Last edited by jo calamine; 12-01-2006 at 11:34 PM..
# 9  
Old 12-01-2006
Quote:
Originally Posted by jo calamine
kill -9 'ps -ef |grep vi awk {vi}'

This is not the command said above,
should be like
Code:
kill -9 `ps -ef | grep vi | awk '{print $2}'`

take care of the backticks
before executing the kill command, make sure with the list of pids that only the correct process is being terminated Smilie
# 10  
Old 12-01-2006
THANKS MUCH
works like a champ, as far as the , What option is used with kill to cause the server to reread its config file. Is there an option for this or does this happen if the init process is killed?
# 11  
Old 12-01-2006
This question doesn't make sense. What server are you talking about? (If you're referring to inetd, "man inetd" should help. ) Didn't you say this was a homework question?

Oh, and if you kill the init process, you shutdown the machine. ( Init is the parent, grandparent, etc, of all other processes. )
# 12  
Old 12-01-2006
The reason you can't just kill a process by the command name is that there may be multiple commands running with the same name. For example, If I'm logged in with bash, and Bob is also logged in with bash, and I try to kill "bash", which one will it kill?

If you want to kill every possible instance of a command with a certain name, "killall" is available on some systems.
# 13  
Old 12-01-2006
thanks for the info

Last edited by jo calamine; 12-02-2006 at 01:30 AM..
# 14  
Old 12-02-2006
Quote:
Originally Posted by jo calamine
What option is used with kill to cause the server to reread its config file.
-9 is a force kill, what you want is -1 which is the same as -HUP
Code:
kill -1
or
kill -HUP

FYI....
The signals currently defined by <signal.h> are as follows:
Code:
     Name             Value   Default    Event
     SIGHUP           1       Exit       Hangup
     SIGINT           2       Exit       Interrupt
     SIGQUIT          3       Core       Quit 
     SIGILL           4       Core       Illegal Instruction
     SIGTRAP          5       Core       Trace or Breakpoint Trap
     SIGABRT          6       Core       Abort
     SIGEMT           7       Core       Emulation Trap
     SIGFPE           8       Core       Arithmetic Exception
     SIGKILL          9       Exit       Killed
     SIGBUS           10      Core       Bus Error
     SIGSEGV          11      Core       Segmentation Fault
     SIGSYS           12      Core       Bad System Call
     SIGPIPE          13      Exit       Broken Pipe
     SIGALRM          14      Exit       Alarm Clock
     SIGTERM          15      Exit       Terminated
     SIGUSR1          16      Exit       User Signal 1
     SIGUSR2          17      Exit       User Signal 2
     SIGCHLD          18      Ignore     Child Status Changed
     SIGPWR           19      Ignore     Power Fail or Restart
     SIGWINCH         20      Ignore     Window Size Change
     SIGURG           21      Ignore     Urgent Socket Condition
     SIGPOLL          22      Exit       Pollable Event 
     SIGSTOP          23      Stop       Stopped (signal)
     SIGTSTP          24      Stop       Stopped (user)
     SIGCONT          25      Ignore     Continued
     SIGTTIN          26      Stop       Stopped (tty input)
     SIGTTOU          27      Stop       Stopped (tty output)
     SIGVTALRM        28      Exit       Virtual Timer Expired
     SIGPROF          29      Exit       Profiling Timer Expired
     SIGXCPU          30      Core       CPU   time   limit   exceeded
     SIGXFSZ          31      Core       File   size   limit   exceeded
     SIGWAITING       32      Ignore     Concurrency   signal   reserved    by
                                         threads library
     SIGLWP           33      Ignore     Inter-LWP signal reserved by  threads
                                         library
     SIGFREEZE        34      Ignore     Check point Freeze
     SIGTHAW          35      Ignore     Check point Thaw
     SIGCANCEL        36      Ignore     Cancellation   signal   reserved   by
                                         threads library
     SIGXRES          37      Ignore     Resource   control   exceeded

The ones that interest you would be the exit ones, like 1, 2, 9 etc...

Last edited by Tornado; 12-02-2006 at 04:41 AM..
Tornado
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Trap killing PID

Hi, Just wonder if there is a way to identify the PID of the killing process using trap. Please let me know possible solution. #!/bin/ksh hello () { print "in hello"; print "PID of process issued SIGNAL"; --> this is what i'm looking for. } trap hello SIGKILL SIGTERM while... (3 Replies)
Discussion started by: Gajendra_PH
3 Replies

2. UNIX for Dummies Questions & Answers

Need script for killing Pid in Linux

need script(shell or python) for killing pid in linux (2 Replies)
Discussion started by: roshan9995
2 Replies

3. Shell Programming and Scripting

Killing the process ID's

Hi , I have a list of application process id's. Is there a way to kill all the process listed below using the script, except the once which are starting with " Genesis " adm 1522 ABC_Process.tra adm 1939 Genesis_Process.tra adm 2729 Genesis_Archive.tra adm 3259 xyz_Process.tra (5 Replies)
Discussion started by: murali1687
5 Replies

4. Shell Programming and Scripting

Finding the age of a unix process, killing old processes, killing zombie processes

I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time. Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies

5. Solaris

Finding PID of Killing process

Say I have 2 processes(perl scripts on Solaris machine) A and B. the process A kill the process B. While in the process B how do I print the PID of the process that Killed it(process A) before dieing. My process A looks like open(STATS, "ps -ef|"); while ($inputLine = <STATS>) { if... (7 Replies)
Discussion started by: enigma_007
7 Replies

6. Shell Programming and Scripting

Killing process!!!!

Hi friends, i m in big trouble.... i have one script which connects two server ...like below.. script1.sh ------------------------------------- bash test.sh & eval x=$@ export x=`echo $x` #echo $x # ssh user@8.2.5.6 bash /mbbv/location/script.sh $x|sed '/Binary file/d'... (1 Reply)
Discussion started by: Shahul
1 Replies

7. UNIX for Dummies Questions & Answers

Need to get pid of a process and have to store the pid in a variable

Hi, I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this. Thanks in advance, Amudha (7 Replies)
Discussion started by: samudha
7 Replies

8. UNIX for Dummies Questions & Answers

killing the process

Hi, First, I am running a scipt.While the script is running I realize that I dont want the script to be run so I am killing the script externally.Before the process gets terminated or killed it should delete all the temporary files created by the script.How to do this?Can anyone help me? ... (3 Replies)
Discussion started by: arthi
3 Replies

9. Shell Programming and Scripting

Killing of a process and send a mail if the process doesnot come up within 2 minutes

Hi Friends, I am new to this forum as well as new to shell scripting. I have a problem here and i need someone to solve this. Let us consider there are two processes(abc & def).There is a script which kills these two processes(i.e killtheprocess abc). Here abc is the argument . There is a... (1 Reply)
Discussion started by: Prince89
1 Replies

10. Shell Programming and Scripting

killing PID's of ptree

gurus, normally to stop a process ,i need to kill all its child & then parent process. i do it manually as follows bash-2.03$ ps -ef | grep bpm|grep -v grep tibadmin 21882 21875 0 May 27 ? 0:00 /bin/sh ./bpmse_20.sh -Xms512m -Xmx512m /tibco/UpdateCustomer/dat/UpdateCustome ... (0 Replies)
Discussion started by: abhijeetkul
0 Replies
Login or Register to Ask a Question