Sponsored Content
Top Forums Shell Programming and Scripting kill multiple instances of the same program Post 302151526 by matrixmadhan on Sunday 16th of December 2007 03:31:24 AM
Old 12-16-2007
Quote:
Originally Posted by porter
if you have pkill it is a doddle....

[CODE]pkill xterm[/CODE[
Will pkill kill only the instance that a user has permission to kill ?

user A can run the instance proc p1
and user B can also run the same instance proc p1

will pkill identify only the instances from user A and kill only those instances of proc p1

( may be something like ps -fu $user )
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

multiple instances of syslogd - is it possible?

I would like to start up multiple instances of syslog daemon. I am having a little difficulty. Is this at all possible? I have separate syslog.conf1.... syslog.conf5 files. I have linked the daemon to separate files syslogd1 ... syslogd5 I have arranged the rcd.2 start/stop scripts for... (9 Replies)
Discussion started by: Gary Dunn
9 Replies

2. UNIX for Dummies Questions & Answers

Multiple file instances

I am capturing text based reports with a specific program, which works no problem. However, since I send report warehouse output as they are migrated from the database software, on occasion when two capture process' initiate simultaneously, the capture file locks up. Is there a way to setup (in... (1 Reply)
Discussion started by: gozer13
1 Replies

3. Shell Programming and Scripting

Creating instances of a program

Hi, Presently I have script #!/bin/ksh in which 4 executables are executed as 1,2,3 and 4.Executable 2 is an extract program which extracts records from a table.and executable 4 is a program that updates a database. Currenlty this process takes a hell lot of time and my aim is to reduce the... (2 Replies)
Discussion started by: tushar_johri
2 Replies

4. UNIX for Advanced & Expert Users

Multiple (thousands) of Cron Instances

Hey all, I have a box running SUSE SLES 8 and in the past few months the box will randomly spawn thousands of instances of /USR/SBIN/CRON to the point where the box will lock up entirely. Upwards of 14000 instances! I imagine it's using up all of the available files that can be opened at one... (10 Replies)
Discussion started by: sysera
10 Replies

5. Shell Programming and Scripting

detecting multiple instances

Hi Gurus I have a requirement like this. i use solaris OS.. if there are 2 instances of the same ksh file running in the directory, i need to kill the ksh file that started to run latest. suppose ragha.ksh starts running thru cron in abc/xyz directory now ragha.ksh started running by any... (3 Replies)
Discussion started by: ragha81
3 Replies

6. Solaris

ypbind - multiple instances starting

I have built this Solaris 10 server, uses NIS. When the server starts up, two instances of ypbind start. This prevents the server from binding to any domain. The SMF in turn prevents any other network services (sshd and the like) from starting up. Has anyone seen this problem before? (0 Replies)
Discussion started by: blowtorch
0 Replies

7. Shell Programming and Scripting

Multiple instances of a job.

Could you please let me know how to create/make a multiple instances of a job/process in ksh(shell scripting). i.e., at present the parent script is calling another child/dependent script for only once. What we want is, the parent script itself has to execute multiple times, and in each one it... (1 Reply)
Discussion started by: Gangegowda
1 Replies

8. Shell Programming and Scripting

Grep with multiple instances of same pattern

Hi, This is my text file I'm trying to Grep. Apple Location Greenland Rdsds dsds fdfd ddsads http Received Return Immediately Received End My Grep command: grep only--matching 'Location.*Received' Because the keyword Received appears twice, the Grep command will stop at the last... (3 Replies)
Discussion started by: spywarebox
3 Replies

9. Programming

Control multiple program instances - open multiple files problem

Hello. This shouldn't be an unusual problem, but I cannot find anything about it at google or at other search machine. So, I've made an application using C++ and QtCreator. I 've made a new mime type for application's project files. My system (ubuntu 10.10), when I right click a file and I... (3 Replies)
Discussion started by: hakermania
3 Replies

10. Programming

Multiple instances of pthread

Suppose I declare pthread_t clear_thread; and then pthread_create(&clear_thread, &detach, clear_message, this); the thread is supposed to go away, perform the service it is intended to procide, and then kill itself. A little while later, I require this service again, so I say ... (2 Replies)
Discussion started by: clerew
2 Replies
PGREP(1)                                                           User Commands                                                          PGREP(1)

NAME
pgrep, pkill - look up or signal processes based on name and other attributes SYNOPSIS
pgrep [options] pattern pkill [options] pattern DESCRIPTION
pgrep looks through the currently running processes and lists the process IDs which match the selection criteria to stdout. All the crite- ria have to match. For example, $ pgrep -u root sshd will only list the processes called sshd AND owned by root. On the other hand, $ pgrep -u root,daemon will list the processes owned by root OR daemon. pkill will send the specified signal (by default SIGTERM) to each process instead of listing them on stdout. OPTIONS
-signal --signal signal Defines the signal to send to each matched process. Either the numeric or the symbolic signal name can be used. (pkill only.) -c, --count Suppress normal output; instead print a count of matching processes. When count does not match anything, e.g. returns zero, the command will return non-zero value. -d, --delimiter delimiter Sets the string used to delimit each process ID in the output (by default a newline). (pgrep only.) -f, --full The pattern is normally only matched against the process name. When -f is set, the full command line is used. -g, --pgroup pgrp,... Only match processes in the process group IDs listed. Process group 0 is translated into pgrep's or pkill's own process group. -G, --group gid,... Only match processes whose real group ID is listed. Either the numerical or symbolical value may be used. -i, --ignore-case Match processes case-insensitively. -l, --list-name List the process name as well as the process ID. (pgrep only.) -a, --list-full List the full command line as well as the process ID. (pgrep only.) -n, --newest Select only the newest (most recently started) of the matching processes. -o, --oldest Select only the oldest (least recently started) of the matching processes. -P, --parent ppid,... Only match processes whose parent process ID is listed. -s, --session sid,... Only match processes whose process session ID is listed. Session ID 0 is translated into pgrep's or pkill's own session ID. -t, --terminal term,... Only match processes whose controlling terminal is listed. The terminal name should be specified without the "/dev/" prefix. -u, --euid euid,... Only match processes whose effective user ID is listed. Either the numerical or symbolical value may be used. -U, --uid uid,... Only match processes whose real user ID is listed. Either the numerical or symbolical value may be used. -v, --inverse Negates the matching. This option is usually used in pgrep's context. In pkill's context the short option is disabled to avoid accidental usage of the option. -w, --lightweight Shows all thread ids instead of pids in pgrep's context. In pkill's context this option is disabled. -x, --exact Only match processes whose names (or command line if -f is specified) exactly match the pattern. -F, --pidfile file Read PID's from file. This option is perhaps more useful for pkill than pgrep. -L, --logpidfile Fail if pidfile (see -F) not locked. --ns pid Match processes that belong to the same namespaces. Required to run as root to match processes from other users. See --nslist for how to limit which namespaces to match. --nslist name,... Match only the provided namespaces. Available namespaces: ipc, mnt, net, pid, user,uts. -V, --version Display version information and exit. -h, --help Display help and exit. OPERANDS
pattern Specifies an Extended Regular Expression for matching against the process names or command lines. EXAMPLES
Example 1: Find the process ID of the named daemon: $ pgrep -u root named Example 2: Make syslog reread its configuration file: $ pkill -HUP syslogd Example 3: Give detailed information on all xterm processes: $ ps -fp $(pgrep -d, -x xterm) Example 4: Make all netscape processes run nicer: $ renice +4 $(pgrep netscape) EXIT STATUS
0 One or more processes matched the criteria. 1 No processes matched. 2 Syntax error in the command line. 3 Fatal error: out of memory etc. NOTES
The process name used for matching is limited to the 15 characters present in the output of /proc/pid/stat. Use the -f option to match against the complete command line, /proc/pid/cmdline. The running pgrep or pkill process will never report itself as a match. BUGS
The options -n and -o and -v can not be combined. Let me know if you need to do this. Defunct processes are reported. SEE ALSO
ps(1), regex(7), signal(7), killall(1), skill(1), kill(1), kill(2) AUTHOR
Kjetil Torgrim Homme <kjetilho@ifi.uio.no> REPORTING BUGS
Please send bug reports to <procps@freelists.org> procps-ng March 2015 PGREP(1)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy