Which filesystem a command is executing from?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Which filesystem a command is executing from?
# 8  
Old 02-23-2011
Hi there. Tried that on SunOS and AIX and it just returns an unfiltered df listing I'm afraid.
# 9  
Old 02-23-2011
I edited my post may be you should search with 'kuxagen' ?

Code:
ps -o 'user,args' -e | awk '/kuxagent/ {print "~"$1}'

First see the output then try piping df.
# 10  
Old 02-23-2011
My mistake for using the wrong process name in my earlier example.

On Solaris, that command shows the 2 userids running kuxagent, as well as my own userid which is searching for the kuxagent process.

Code:
$ ps -o 'user,args' -e | awk '/kuxagent/ {print "~"$1}'
~itmuser
~asoames
~itmclus

Code:
$ ps -o 'user,args' -e | awk '/kuxagent/ {print "~"$1}' |df

Piping it into df just shows a full df listing with no filtering?
# 11  
Old 02-23-2011
Means it is evaluating the "df" command right?
what filtering you you require? I guess only file system?
Can you show the output of the above command? I am having HP-UX and df output is varies in linux
# 12  
Old 02-23-2011
Code:
$ ps -o 'user,args' -e | awk '/kuxagent/ {print "~"$1}' | df
/                  (/dev/md/dsk/d10   ):10087646 blocks   924064 files
/proc              (/proc             ):       0 blocks    29672 files
/etc/mnttab        (mnttab            ):       0 blocks        0 files
/dev/fd            (fd                ):       0 blocks        0 files
/var               (/dev/md/dsk/d30   ):13831854 blocks  1193823 files
/var/run           (swap              ):29657248 blocks   798312 files
/dev/vx/dmp        (dmpfs             ):29657248 blocks   798312 files
/dev/vx/rdmp       (dmpfs             ):29657248 blocks   798312 files
/tmp               (swap              ):29657248 blocks   798312 files
/home              (/dev/vx/dsk/rootdg/home):  973214 blocks   121649 files
/opt/IBM/ITM              (/dev/vx/dsk/rootdg/ITM): 2061956 blocks   257742 files
/opt/clus2/IBM/ITM       (/dev/vx/dsk/clusdg/ITM): 2063702 blocks   257960 files

...

So what I'm trying to have it display is just the filesystems that contain a running kuxagent process, if that's possible, or maybe I'm not explaining myself too well. Thanks.
# 13  
Old 02-23-2011
So you want to get the first column from the above?

Code:
ps -o 'user,args' -e | awk '/kuxagent/ {print "~"$1}' | df | awk "{print $1}'

# 14  
Old 02-23-2011
Almost. The one-liner commands needs to do this, in order.

1. Are there any kuxagent processes running?
2. Capture the userid that is running each kuxagent process
3. Do a 'df ~userid' command for each userid returned. e.g. df ~itmuser df ~itmclus
4. Which should return the results similar to below.

Code:
/opt/IBM/ITM              (/dev/vx/dsk/rootdg/ITM): 2061956 blocks   257742 files
/opt/clus2/IBM/ITM       (/dev/vx/dsk/clusdg/ITM): 2063702 blocks   257960 file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Command to check on which vg filesystem resides

Hi, I need to know on which volume group filesystem resides. TIA (5 Replies)
Discussion started by: sumanthupar
5 Replies

2. Shell Programming and Scripting

Executing a command in subshell

Hi All, I am trying to create a shell script which runs on my linux machine. The requirement is so that, ade createview xyz -> this steps creates a view ade useview xyz -> we are entering inside the view ade begintrans -> begin a transaction My script has following code : lets say... (2 Replies)
Discussion started by: Dish
2 Replies

3. Solaris

Unix command to fill filesystem

I have been trying to fill all available file space on my Solaris box for my project but have not been successful. I have tried the following script: tr '\0' '\060' < /dev/zero | dd of=zero2.txt bs=1024 count=1953125 But the only thing i get in return is this: "d: bad numeric argument:... (8 Replies)
Discussion started by: rbur101
8 Replies

4. UNIX for Dummies Questions & Answers

executing a command using ssh

Hi All, I am trying to execute a command using ssh as below. ssh user123@servername "which ctmcontb" It is gving the error as below no ctmcontb in /usr/bin /usr/sbin /opt/sysadm/bin Not sure from where the PATH is getting picked up. But When I login direclty to the server I am... (5 Replies)
Discussion started by: anilreddy103
5 Replies

5. AIX

Command executing to be in the background !

Guys I'm working to make in AIX script and I have some commands need to be excited by that script Like the below commands ... startsrc -s sshd I want that executing to be in the background of the system I do not like to see the out put of that (3 Replies)
Discussion started by: Mr.AIX
3 Replies

6. Shell Programming and Scripting

executing command from subdirectories

Hello, I've been trying to run 'ls -1R | wc -l' inside of sub directories to in order to determine how big each folder is. find . -maxdepth 1 -type d | while read folder do cd "$folder" && echo "$folder has $(ls -1R | wc -l) files" && cd .. done or for... (3 Replies)
Discussion started by: NoobProgrammer
3 Replies

7. Solaris

what command was used to create a filesystem

How do we determine what command was used (either newfs or mkfs) to create a filesystem? Thanks, (2 Replies)
Discussion started by: Pouchie1
2 Replies

8. Shell Programming and Scripting

Executing a command at startup

Hey all, How do I execute a file at startup automatically. From what I've read is that I need to put it into my .bashrc file. I'm not sure where to go from there. Can I just type commands into that and they'll run next time I restart my server? Right now I have added these lines: cd... (2 Replies)
Discussion started by: NathanWarden
2 Replies

9. UNIX for Dummies Questions & Answers

Executing a unix command

Hi, I need to execute the following unix command through my java code - zip -e When i execute this command from the command prompt, i am prompted for a password in the following manner - Enter password: Verify password: Is it possible to provide the password inthe first command itself... (5 Replies)
Discussion started by: jacob23
5 Replies

10. Solaris

What is the command to increase filesystem on solaris

I wanted to know what is the process or command to increase a filesystem on solaris. For example the /tmp directory. (3 Replies)
Discussion started by: strikelit
3 Replies
Login or Register to Ask a Question