- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: retrieve absolute path from pid
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 07:29 PM
тАО10-14-2004 07:29 PM
I have the pid of the process. Using this pid i should retrieve the absolute path name of the executable. I tried pstat_getproc(), but it gives only the basename of the executable. I need the full path. Is there any system call available in HP-UX to do that or can i do this using scripting?
Thanks,
Prakash.
Solved! Go to Solution.
- Tags:
- pstat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 07:45 PM
тАО10-14-2004 07:45 PM
Re: retrieve absolute path from pid
# UNIX95= ps -e -o ruser,pid,vsz,args
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 07:50 PM
тАО10-14-2004 07:50 PM
Re: retrieve absolute path from pid
you can user the "UNIX95" option
eg
UNIX95= ps -eo time,vsz,pid,args
(see "columns" from man ps for more options)
and be aware of the " " before ps
This should give you what you want
Regards
Franky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 07:55 PM
тАО10-14-2004 07:55 PM
Re: retrieve absolute path from pid
How about this one.
# PIDNO=xxxx
# ps -ef | grep $PIDNO | grep -v grep | awk '{ print $9 }'
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 08:02 PM
тАО10-14-2004 08:02 PM
Re: retrieve absolute path from pid
I invoke a executable ./a.out in /tmp/one.
Now i am in some different directory and try using the script provided i still get as
./a.out and not as /tmp/one/a.out.
Prakash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 08:21 PM
тАО10-14-2004 08:21 PM
Re: retrieve absolute path from pid
if you start is as # /tmp/one/a.out (without the .)the full path wil be visible in the ps list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 09:16 PM
тАО10-14-2004 09:16 PM
Re: retrieve absolute path from pid
We can not get it using ps command there. We can get basename of execution, if we execute them as only that command. We can full path name when we does with full path name.
You can go to glance tool, to know more about a process there. I am not sure which will give or not.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-14-2004 09:31 PM
тАО10-14-2004 09:31 PM
Re: retrieve absolute path from pid
PATH output from ps is limited to 80 characters. If the PATH is longer you don't get it.
I am curious if anybody know how to get full PATH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 12:18 AM
тАО10-15-2004 12:18 AM
Re: retrieve absolute path from pid
ps -efx
NOTE: -x is *only* available for patched versions of ps (11.00 and 11i only).
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 12:24 AM
тАО10-15-2004 12:24 AM
Re: retrieve absolute path from pid
Thanks,
Prakash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 12:27 AM
тАО10-15-2004 12:27 AM
Re: retrieve absolute path from pid
ps -efx|grep "xyz"
UNIX95= ps -ef -o "ruser,args,pid" | grep "xyz"
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 01:14 AM
тАО10-15-2004 01:14 AM
Re: retrieve absolute path from pid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 01:48 AM
тАО10-15-2004 01:48 AM
Solution---
#include
#include
int main (int argc, char *argv[])
{
struct pst_vm_status vmstat;
struct pst_filedetails psfdetails;
char name[1024];
int ret;
int pid = atoi(argv[1]);
/* last parameter to getprocvm is 1 */
/* because it worked :P will confirm */
/* with vm folks later */
if ((ret = pstat_getprocvm(&vmstat, sizeof(vmstat), pid, 1)) <0) {
perror("pstat_getprocvm");
exit(10);
}
if ((ret=pstat_getfiledetails(&psfdetails, sizeof(psfdetails),&(vmstat.pst_fid))) <0) {
perror("pstat_getfiledetails");
exit(20);
}
// printf ("device: %d, inode: %u\n", psfdetails.psfd_rdev, psfdetails.psfd_ino);
if ((ret=pstat_getpathname(name, 256, &(vmstat.pst_fid))) <0) {
perror("pstat_getpathname");
exit(30);
}
puts(name);
}
---
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 01:49 AM
тАО10-15-2004 01:49 AM
Re: retrieve absolute path from pid
--
ranga
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 01:51 AM
тАО10-15-2004 01:51 AM
Re: retrieve absolute path from pid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-15-2004 02:35 AM
тАО10-15-2004 02:35 AM
Re: retrieve absolute path from pid
This is to track down the childs.
Hope it helps..
/bin/ps -ef | awk -v v=
Thanks
Prashant