Is there any build in command in unix to kill all the child process for a given process ID ? If any one has script or command, please let me know.
Thanks
Sanjay (4 Replies)
Hi there, i wonder if anyone can help
is there any way that i can write a script that will kill all current ftp processes, for example if ps -ef | grep ftp produces 3 active proceses, then I would like to somehow extract the PID for each one and pass that to kill -9
has anybody done this... (2 Replies)
Hi All,
In my project i have two process runs in the back end.
Once i start my project, and execute the command ps, i get below output:
PID TTY TIME CMD
9086 pts/1 0:00 ksh
9241 pts/1 0:02 java
9240 pts/1 0:00 shell_script_bg
java with 9241 PID is the main... (4 Replies)
Hello all
i have simple script that executing program every 10 seconds
im invoke this script as daemon with second script that put it in the background
this is my first script (IsAliveTester.csh)
#!/bin/csh -f
@ iSleep = 10
set processName = "ClientTester"
while(1)
$processName
... (0 Replies)
#!/bin/sh
who
echo "\r"
echo Enter the terminal ID of the user in use:
echo "\r"
read TERM_ID
echo "\r"
ps -t $TERM_ID | grep sh
echo "\r"
echo Enter the process number to end:
echo "\r"
read PID
echo "\r"
kill -9 $PID
What this code does is ultimately grab the PID of a users sh... (6 Replies)
I would want to run a code for 1 min and if it doesnt succeed in 1 min..I would want to exit it..I am using the following code...But the script is not going into my code part.It is waiting for 60 secs and then getting killed.
The code which is in the while loop actually takes less than 60 secs...... (6 Replies)
Hi,
I am new to shell scripting and want to create a script with the follwoing description:
I want to restrict the users from giving a kill command on a unix server. The server have a restricted logins with login id and passwords. I want a script that will find out if a user has given a... (9 Replies)
Hi,
I wrote a script to kill a process id.
I am able to kill the PID only if I enter the root password in the middle of the execution because I did not run as root i.e after i run the script from the terminal, instead of killing directly, it is killing only after entering the pass when it... (12 Replies)
Hi,
I'm trying to write a script where i'm trying to grep the PID and the associated file and list them. Then execute the KILL command sequentially on the listed PID's for ".tra" files
====================================================
ps -aux | grep mine
adm 27739 0.2 0.8 1131588... (12 Replies)
Hi All, Looking for a quick LINUX shell script which can continuously monitors the flle size, report the process which is creating a file greater than certain limit and also kill that process. Can someone please help me on this? (4 Replies)
Discussion started by: vasavimacherla
4 Replies
LEARN ABOUT SUNOS
kill
kill(2) System Calls kill(2)NAME
kill - send a signal to a process or a group of processes
SYNOPSIS
#include <sys/types.h>
#include <signal.h>
int kill(pid_t pid, int sig);
DESCRIPTION
The kill() function sends a signal to a process or a group of processes. The process or group of processes to which the signal is to be
sent is specified by pid. The signal that is to be sent is specified by sig and is either one from the list given in signal (see sig-
nal.h(3HEAD)), or 0. If sig is 0 (the null signal), error checking is performed but no signal is actually sent. This can be used to check
the validity of pid.
The real or effective user ID of the sending process must match the real or saved (from one of functions in the exec(2) family) user ID of
the receiving process, unless the privilege {PRIV_PROC_OWNER} is asserted in the effective set of the sending process (see intro(2)), or
sig is SIGCONT and the sending process has the same session ID as the receiving process. A process needs the basic privilege
{PRIV_PROC_SESSION} to send signals to a process with a different session ID. See privileges(5).
If pid is greater than 0, sig will be sent to the process whose process ID is equal to pid.
If pid is negative but not (pid_t)-1, sig will be sent to all processes whose process group ID is equal to the absolute value of pid and
for which the process has permission to send a signal.
If pid is 0, sig will be sent to all processes excluding special processes (see intro(2)) whose process group ID is equal to the process
group ID of the sender.
If pid is (pid_t)-1 and the {PRIV_PROC_OWNER} privilege is not asserted in the effective set of the sending process, sig will be sent to
all processes excluding special processes whose real user ID is equal to the effective user ID of the sender.
If pid is (pid_t)-1 and the {PRIV_PROC_OWNER} privilege is asserted in the effective set of the sending process, sig will be sent to all
processes excluding special processes.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned, no signal is sent, and errno is set to indicate the error.
ERRORS
The kill() function will fail if:
EINVAL The sig argument is not a valid signal number.
EPERM The sig argument is SIGKILL and the pid argument is (pid_t)-1 (that is, the calling process does not have permission to
send the signal to any of the processes specified by pid).
The effective user of the calling process does not match the real or saved user and the calling process does not have the
{PRIV_PROC_OWNER} privilege asserted in the effective set, and the calling process either is not sending SIGCONT to a
process that shares the same session ID or does not have the {PRIV_PROC_SESSION} privilege asserted and is trying to send a
signal to a process with a different session ID.
ESRCH No process or process group can be found corresponding to that specified by pid.
USAGE
The sigsend(2) function provides a more versatile way to send signals to processes.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Async-Signal-Safe |
+-----------------------------+-----------------------------+
SEE ALSO kill(1), intro(2), exec(2), getpid(2), getsid(2), setpgrp(2), sigaction(2), sigsend(2), signal(3C), signal.h(3HEAD), attributes(5), privi-
leges(5), standards(5)SunOS 5.10 22 Mar 2004 kill(2)