Sponsored Content
Top Forums Shell Programming and Scripting find the Root ID from the processes Post 302275614 by tonan on Sunday 11th of January 2009 02:26:03 PM
Old 01-11-2009
MySQL Thankyou summer cherry

Hey that was spot on SmilieSmilie, Since i am using the ps comand to fetch the above pids i can use the awk to find my result. Here is the command.

Code:
ps -aef|grep dmadmin2|grep document
dmadmin2 18264 18253  0 00:41:28 ?        0:00 ./documentum -docbase_name decm1 -security acl -init_file /apps/docm/dba/config
dmadmin2 18376 18253  0 00:42:20 ?        0:04 ./documentum -docbase_name decm1 -security acl -init_file /apps/docm/dba/config
dmadmin2 18266 18253  0 00:41:29 ?        0:00 ./documentum -docbase_name decm1 -security acl -init_file /apps/docm/dba/config
dmadmin2 18268 18253  0 00:41:30 ?        0:00 ./documentum -docbase_name decm1 -security acl -init_file /apps/docm/dba/config
dmadmin2 18262 18253  0 00:41:27 ?        1:24 ./documentum -docbase_name decm1 -security acl -init_file /apps/docm/dba/config
dmadmin2 18253     1  0 00:41:12 ?        0:12 ./documentum -docbase_name decm1 -security acl -init_file /apps/docm/dba/config

$ ps -aef|grep dmadmin2|grep document|awk '$3==1 {print}'

dmadmin2 18253     1  0 00:41:12 ?        0:12 ./documentum -docbase_name decm1 -security acl -init_file /apps/docm/dba/config

Now i need to get the root pid from this so i modified it to

Code:
ps -aef|grep dmadmin2|grep document|awk '$3==1 {print $2}'
18253

Thankyou very much for the quick help.

Regards.
 

10 More Discussions You Might Find Interesting

1. Programming

C program to kill root processes

Hello, First let me start by saying I have searched the forum and read all the SUID stuff but it is not in the neighborhood I am looking for. Here is the problem. We want to grant a non super-user permission to kill root processes but only if the process matches certain criteria. ... (8 Replies)
Discussion started by: TioTony
8 Replies

2. Solaris

How to find number of processes ?

Hi , I need to count all processes contains the pattren "FND" For Example: I was reteriving the details of all processes related to "FND" by this command $ ps -ef | grep FND but now I just wanna count them . Regards Adel (2 Replies)
Discussion started by: ArabOracle.com
2 Replies

3. UNIX for Advanced & Expert Users

find my tree of processes

Hi. I am logging into a remote unix/linux server (of any kind - aix, hpux, linux...) I would like to run a shell command that will return me the list of PIDs that relate to my tree. I need to get the PID of my father, and my self. I know that my SSHD process openes a BASH process. need both... (2 Replies)
Discussion started by: yamsin789
2 Replies

4. AIX

Can't login root account due to can't find root shell

Hi, yesterday, I changed root's shell in /etc/passwd, cause a mistake then I can not log in root account (can't find correct shell). I attempted to log in single-mode, however, it prompted for single-mode's password then I type root's password but still can not log in. I'm using AIX 5L version 5.2... (2 Replies)
Discussion started by: neikel
2 Replies

5. UNIX for Dummies Questions & Answers

If user has own crontab, results in accumulation of root CRON processes

Hello, I seem to be having a problem with accumulation of root CRON jobs occuring when I have a user's cron job(s) running. Here is an example of a user's crontab file: */1 * * * * echo "hello" > /dev/nullps aux|grep CRON root 14333 0.0 0.0 91236 2172 ? S ... (12 Replies)
Discussion started by: Narnie
12 Replies

6. Shell Programming and Scripting

what is the find command to find exact dir from the root

I want to find a dir called STOP from the root.so what is the find command. Thanks & Regards Rajkumar (1 Reply)
Discussion started by: rajkumar_g
1 Replies

7. UNIX for Dummies Questions & Answers

What are these different tty processes(tty1,tty2..) running as root mentioned n the list below.

Hi, I need your help to understand about different processes(tty1,tty2,tty3...) running as root as shown below .What exactly these processes do? root@bisu-desktop:~# ps -eaf | grep -e tty -e UID UID PID PPID C STIME TTY TIME CMD root 761 1 0 10:30 tty5 ... (4 Replies)
Discussion started by: crazybisu
4 Replies

8. Shell Programming and Scripting

Find users with root UID or GID or root home

I need to list users in /etc/passwd with root's GID or UID or /root as home directory If we have these entries in /etc/passwd root:x:0:0:root:/root:/bin/bash rootgooduser1:x:100:100::/home/gooduser1:/bin/bash baduser1:x:0:300::/home/baduser1:/bin/bash... (6 Replies)
Discussion started by: anil510
6 Replies

9. UNIX for Dummies Questions & Answers

How do I find the number of processes running on root?

Is there a certain man command I'm missing here? I searched in ps but I couldn't find something that would give me the number of processes running on root. I only want to see the number of processes, not the processes itself. (2 Replies)
Discussion started by: l3monz
2 Replies

10. AIX

Kill multiple processes ran by root

Hi all, I have about 5-6 daemons specific to my application running in the background. I am trying to write a script to stop them. Usually, I run them as a non-root ID, which is fine. But for some reason the client insists on using root. I do have sudo. I just tried something like this ... (4 Replies)
Discussion started by: jeffs42885
4 Replies
PIDOF(8)						Linux System Administrator's Manual						  PIDOF(8)

NAME
pidof -- find the process ID of a running program. SYNOPSIS
pidof [-s] [-c] [-n] [-x] [-o omitpid[,omitpid..]] [-o omitpid[,omitpid..]..] program [program..] DESCRIPTION
Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. This program is on some systems used in run-level change scripts, especially when the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should be used instead. OPTIONS
-s Single shot - this instructs the program to only return one pid. -c Only return process ids that are running with the same root directory. This option is ignored for non-root users, as they will be unable to check the current root directory of processes they do not own. -n Avoid stat(2) system function call on all binaries which are located on network based file systems like NFS. Instead of using this option the the variable PIDOF_NETFS may be set and exported. -x Scripts too - this causes the program to also return process id's of shells running the named scripts. -o omitpid Tells pidof to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof pro- gram, in other words the calling shell or shell script. EXIT STATUS
0 At least one program was found with the requested name. 1 No program was found with the requested name. NOTES
pidof is actually the same program as killall5; the program behaves according to the name under which it is called. When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs. Note that that the executable name of running processes is calculated with readlink(2), so symbolic links to executables will also match. SEE ALSO
shutdown(8), init(8), halt(8), reboot(8), killall5(8) AUTHOR
Miquel van Smoorenburg, miquels@cistron.nl 01 Sep 1998 PIDOF(8)
All times are GMT -4. The time now is 04:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy