Have you considered multiple instances of this script running at once? pgrep allows matching only to processes from the current session with --session 0 this may stop you subshell hanging around until all instances of links have ended:
This User Gave Thanks to Chubler_XL For This Post:
Now I am just getting frustrated and confused... if anyone has some advice on how this anomoly is occurring I would greatly appreciate it.
cat helpme.txt | awk 'NR<5{printf("%-20s %-20d %-20d %-20.1f\n","hello",$1,$2,$3)}' | sort -rk4
This line works fine in solo - reads the three fields from... (4 Replies)
Hi,
I want a command in unix shell script which will exit my whole program, not only from the function it's using. For e.g:
$1 == "m_who" && $4 == "Extrnl Vendor" {
print "You don have access"
exit (0);
}
If this error is showing on the screen, then nothing should not... (9 Replies)
hi
while executing the following script, my terminal window is getting closed if I enter a invalid option. I want the script should go back the the command prompt. how to do achive it. i execute the script as . ./test
#! /usr/bin/ksh
Printf " Type of Installer : \n\t\t 1. Whole Build... (3 Replies)
This is a fairly complex issue. I do not have a lot of knowledge on X11. But here are the things.
I am running a program called Synergy off a Solaris server. The server sits in a remote network and can be accessed via NAT. Using Putty, I will enable X11 forwarding and launch Synergy via Putty.... (0 Replies)
hi All
I have a scritp running which connects to a local host and then gets a value from a field and then ftp that value to antoher server. It is running fine, and from crontab it gives the output to a file, the problem is sometime it doesnt run but if i check the output file it does not show one... (0 Replies)
Hey , guys I am new to shell programing ,, so need a help from you guys ...
I have to write a shell script that accepts file name or directory name from the user if it is a directory then throw an error if it is a file then give the user two options .
1.overwrite the content
2.append the... (2 Replies)
Greetings, I have a C-program that is made to implement a hidden Markov model on an input file. The program is very memory intensive.
I've installed it on my local server where I have an account and it compiles fine. The way they have the server set up is that you can either work... (1 Reply)
REALLY new to this stuff, sorry.
So I want a shell script to open a program, wait 45 minutes, close it, and then do it all again. I want to do this because I am running an iMacros Script for a long period of time and if Firefox is not constantly restarted, memory leaks start to happen.
Anyway... (6 Replies)
I have a file with two line, one is header, the other actual value:
TYPCD|ETID2|ETID|LEG ID|PTYP|PTYP SUB|TRD STATUS|CXL REASON|CACT|CACTNM|ENCD|ENC
D NM|TRDR|ASDT|TRDT|MTDT|STDT|LS|SECID|SECID TYP|SECNM|PAR|STCC|MARKET PRICE|DIS
MARKET PRICE|MARKET PRICE CURRENCY|SRC OF SETTLEMENT... (2 Replies)
Hello all..
so i have a problem i need to solve ..
#! /bin/bash
$SHELL
dtterm -title my_prog -e su -user -c 'export DISPLAY=:0.0 ; /path/to/my/prog' & 2> /dev/null
$SHELL
intr
exit
This script will work on solaris 10 system in right clikt menu - in a secure system so i need to... (0 Replies)
Discussion started by: defs
0 Replies
LEARN ABOUT DEBIAN
pgrep
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 matches the selection criteria to stdout. All the cri-
teria 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. (pgrep only.)
-d, --delimeter 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.
-l, --list-name
List the process name 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 usually used in pgrep context. In pkill context the short option is disabled to avoid accidental
usage of the option.
-x, --exact
Only match processes whose name (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.
-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)STANDARDS
pkill and pgrep were introduced in Sun's Solaris 7. This implementation is fully compatible.
AUTHOR
Kjetil Torgrim Homme <kjetilho@ifi.uio.no>
REPORTING BUGS
Please send bug reports to <procps@freelists.org>
procps-ng September 2011 PGREP(1)