Hpux pkill,a little help with script


 
Thread Tools Search this Thread
Operating Systems HP-UX Hpux pkill,a little help with script
# 8  
Old 05-28-2013
Don't work

Code:
#!/usr/bin/sh
COMM=${1}
shift
UNIX95=1 ps -C ${COMM} -o pid='' | while read P
do
kill $1 ${P}
done

Code:
[root@hpux src]# 
pkill -9  inetd

ps -ef|grep inetd
  root   938     1  0 18:35:25 ?         0:00 /usr/sbin/inetd

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Hpux and bacula script

# bacula status /opt/bacula/bin/bacula-ctl-fd: UNIX95=1;: not found bacula-fd is stopped #! /bin/sh # # bacula-ctl-fd This shell script takes care of starting and stopping # the bacula File daemon. # # This is pretty much watered down version of the RedHat script # that... (9 Replies)
Discussion started by: Linusolaradm1
9 Replies

2. UNIX and Linux Applications

Unix pkill error; does wily obstruct me killing the process?

have two scripts on Unix; one that starts some processes and the other one for killing a process. At first, I ran the .sh without WILY in it and it worked perfectly; in this way, I could also ran my stopper process. However I need WILY in this so I added it to my script but this time, a message... (1 Reply)
Discussion started by: nerdogan551
1 Replies

3. UNIX for Advanced & Expert Users

pkill won't work on firefox anymore

Can someone tell me why pkill won't work on firefox anymore? (11 Replies)
Discussion started by: cokedude
11 Replies

4. Shell Programming and Scripting

Pkill Argument issue

Hi All, I am writing a shell script to kill user processes on all servers using pkill. But when i am passing user id directly ist works but when password userid as variable its not working & getting the below error. # ssh hpadmin@vmtest15.zin33 'sudo /usr/bin/pkill -u $unixid'... (2 Replies)
Discussion started by: ajaincv
2 Replies

5. HP-UX

pwage-hpux-T for Trusted HPUX servers

I'm sharing this in case anybody needs it. Modified from the original solaris pwage script. This modified hpux script will check /etc/password file on hpux trusted systems search /tcb and grep the required u_succhg field. Calculate days to expiry and notify users via email. original solaris... (2 Replies)
Discussion started by: sparcguy
2 Replies

6. Shell Programming and Scripting

Suppressing the terminated message from pkill & killall commands in a bash script

Hi all, I've been pulling my hair out with this problem for 3 days:wall: now without success any help would be massively appreciated. Basically the script is used to shutdown a rails server so a new IP address can be assigned, the shutdown part is taken care of in function_one using the... (2 Replies)
Discussion started by: danmc
2 Replies

7. Linux

Script migration help from HPUX

Hi, We are looking for the extensive list of Commands/Syntax that were working in HP-UX and will not work on LINUX. We would find such commands and modify them accordingly. Do we have any reference sites or documents. You help would be greatly appreciated. Thanks in advance (2 Replies)
Discussion started by: vijaipersonal
2 Replies

8. UNIX for Dummies Questions & Answers

kill/pkill process by CMD info.

I have a process that I'd like to kill. Doing a "ps -fu myusername" gives me: UID PID PPID C STIME TTY TIME CMD myusername 5443 1 0 10:05 ? 00:00:00 /bin/sh /some/path/crap.sh -s /yet/another/path/parentProcess myusername 5593 5443 0 ... (2 Replies)
Discussion started by: mrwatkin
2 Replies

9. Shell Programming and Scripting

Need Script to Use CPUs on a HPUX server to simulate Workload Manager on HPUX.

I am running HPUX and using WLM (workload manager). I want to write a script to fork CPUs to basically take CPUs from other servers to show that the communication is working and CPU licensing is working. Basically, I want to build a script that will use up CPU on a server. Any ideas? (2 Replies)
Discussion started by: cpolikowsky
2 Replies

10. Solaris

Diffirence between Kill and Pkill Command???

Diffirence between Kill and Pkill Command??? (1 Reply)
Discussion started by: udayn
1 Replies
Login or Register to Ask a Question
PGREP(1)							Linux User's Manual							  PGREP(1)

NAME
pgrep, pkill - look up or signal processes based on name and other attributes SYNOPSIS
pgrep [-cflvx] [-d delimiter] [-n|-o] [-P ppid,...] [-g pgrp,...] [-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...] [-t term,...] [pattern] pkill [-signal] [-fvx] [-n|-o] [-P ppid,...] [-g pgrp,...] [-s sid,...] [-u euid,...] [-U uid,...] [-G gid,...] [-t term,...] [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
-c Suppress normal output; instead print a count of matching processes. -d delimiter Sets the string used to delimit each process ID in the output (by default a newline). (pgrep only.) -f The pattern is normally only matched against the process name. When -f is set, the full command line is used. -g 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 gid,... Only match processes whose real group ID is listed. Either the numerical or symbolical value may be used. -l List the process name as well as the process ID. (pgrep only.) -n Select only the newest (most recently started) of the matching processes. -o Select only the oldest (least recently started) of the matching processes. -P ppid,... Only match processes whose parent process ID is listed. -s 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 term,... Only match processes whose controlling terminal is listed. The terminal name should be specified without the "/dev/" prefix. -u euid,... Only match processes whose effective user ID is listed. Either the numerical or symbolical value may be used. -U uid,... Only match processes whose real user ID is listed. Either the numerical or symbolical value may be used. -v Negates the matching. -x Only match processes whose name (or command line if -f is specified) exactly match the pattern. -signal Defines the signal to send to each matched process. Either the numeric or the symbolic signal name can be used. (pkill only.) 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: unix$ pgrep -u root named Example 2: Make syslog reread its configuration file: unix$ pkill -HUP syslogd Example 3: Give detailed information on all xterm processes: unix$ ps -fp $(pgrep -d, -x xterm) Example 4: Make all netscape processes run nicer: unix$ 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> Albert Cahalan <albert@users.sf.net> is the current maintainer of the procps package. Please send bug reports to <procps-feedback@lists.sf.net> Linux June 25, 2000 PGREP(1)