Sponsored Content
Top Forums Shell Programming and Scripting script to loop all process ids and take pmap Post 302360104 by radoulov on Thursday 8th of October 2009 06:47:14 AM
Old 10-08-2009
Do not use /bin/sh for that script:


Code:
ps -eo pid | 
  while read; do
    pid="$(($REPLY))"
    pmap > ./pmap_"$pid" -x "$pid" 2>/dev/null ||
      printf 'error printing address space map for pid %d\n' "$pid" >&2
  done

 

10 More Discussions You Might Find Interesting

1. Programming

List of Thread IDs of a process

Hello, Can some one tell how to read the thread IDs of the current process in Sun Solaris. Any help will be appreciated. regards, Murali (0 Replies)
Discussion started by: hmurali
0 Replies

2. UNIX for Advanced & Expert Users

Problem to track process IDs in HP-UX machine

Hello All, I need to track the exact process ID related to a particular application running on HP-UX machine. i.e. the exact functionality of fuser unix command. fuser application.log // It gives the exact process ID for application.log Since there is no provision for 'fuser' in HP-UX... (13 Replies)
Discussion started by: abhishek0071
13 Replies

3. Red Hat

pmap -d ldap-process-id

Hi All, Is the command above dangerous to run on the ldap environment? Thanks for any comments you may add. (1 Reply)
Discussion started by: itik
1 Replies

4. UNIX for Dummies Questions & Answers

Scripting - process and user ids...Help please

Hello all: Working on a job I was asked get a simple script to perform the following task and would like to ask for some help. I'm looking forward to learning more and diving deeper into the World of Open Source servers. I need a script for a Unix server, using as few lines as possible, that... (4 Replies)
Discussion started by: moahten
4 Replies

5. AIX

Process ids consuming huge resources ?

Hi All what is the command to check process ids , which are running from long time and which are consuming more cpu? Also how to check, what a particular PID is running what For Ex: i have a pid :3223722 which is running since from long time, if i want to check what is this... (1 Reply)
Discussion started by: sidharthmellam
1 Replies

6. Solaris

loop for pmap -x

I would to create a command /script where I want lauch pmap -x pid for each procces which is launched on server , and I don't know how to write a loop where it would be included . (2 Replies)
Discussion started by: kvok
2 Replies

7. Shell Programming and Scripting

Script for to kill the process Ids when restarting the unix server

Hi, I need a script to kill the process Ids for the user ABC. I prepared the following script after that while logging with user therough script i am not sure how to pass the user name and password.Can ou modify the script and help me out. #!/bin/bash for filesize in $(ls -ltr | grep... (4 Replies)
Discussion started by: victory
4 Replies

8. Shell Programming and Scripting

ps returning more process ids

Please help me with this question I have a tantan.sh under /home/mydir which is a caller to another script "tantan.sh" under /home/anotherdir ----------------------------------------------------------- /home/mydir/tantan.sh ------------------------------------------------------------... (6 Replies)
Discussion started by: guruincredible
6 Replies

9. Shell Programming and Scripting

Search process ids

Hi, I have four tomcat instances named PNK, PNK1, PNK2, PNK3. All are running on the same server. To kill tomcat instance I usually do below for PNK1,PNK2,PNK3 kill -9 `ps -ef|grep tomcat|grep PNK1|grep -v grep|awk '{print $2}'` But the above command does not work for PNK. Can some... (7 Replies)
Discussion started by: lpprasad321
7 Replies

10. Shell Programming and Scripting

List out Process ids restarted today

Hi, I need to list out the processes which are started/restarted today in my Solaris box. If not possible need to convert the process uptime in minutes or seconds and compare it with a configurable value to list out those process ids for further processing in my scripting. Can any one guide... (7 Replies)
Discussion started by: ananan
7 Replies
setpgid(2)							   System Calls 							setpgid(2)

NAME
setpgid - set process group ID SYNOPSIS
#include <sys/types.h> #include <unistd.h> int setpgid(pid_t pid, pid_t pgid); DESCRIPTION
The setpgid() function sets the process group ID of the process with ID pid to pgid. If pgid is equal to pid, the process becomes a process group leader. See intro(2) for more information on session leaders and process group leaders. If pgid is not equal to pid, the process becomes a member of an existing process group. If pid is equal to 0, the process ID of the calling process is used. If pgid is equal to 0, the process specified by pid becomes a process group leader. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The setpgid() function will fail if: EACCES The pid argument matches the process ID of a child process of the calling process and the child process has successfully executed one of the exec family of functions (see exec(2)). EINVAL The pgid argument is less than (pid_t) 0 or greater than or equal to PID_MAX, or the calling process has a controlling ter- minal that does not support job control. EPERM The process indicated by the pid argument is a session leader. EPERM The pid argument matches the process ID of a child process of the calling process and the child process is not in the same session as the calling process. EPERM The pgid argument does not match the process ID of the process indicated by the pid argument, and there is no process with a process group ID that matches pgid in the same session as the calling process. ESRCH The pid argument does not match the process ID of the calling process or of a child process of the calling process. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
intro(2), exec(2), exit(2), fork(2), getpid(2), getsid(2), attributes(5), standards(5) SunOS 5.10 28 Dec 1996 setpgid(2)
All times are GMT -4. The time now is 03:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy