This article is from a FAQ concerning SCO operating
systems. While some of the information may be applicable to any OS,
or any Unix or Linux OS, it may be specific to SCO Xenix, Open
Desktop or Openserver.
There is lots of Linux, Mac OS X and general Unix info elsewhere on
this site: Search this site is the best
way to find anything.
You can use the concept here to back trace any process. This script will find the first ancestor process after init. This would be sshd or telnet or just a getty, etc.
MYPROC=$$
NEXTPROC=$MYPROC
while [ $NEXTPROC != 1 ]
do
MYPROC=$NEXTPROC
NEXTPROC=`ps -p $MYPROC -o "ppid=" `
done
ps -p $MYPROC -o args=
Fabio Gianotti observed:
Not to be picky, but on my system, the above script returns "/etc/inetd" if
you've used either telnet or rlogin , so I changed it slightly:
echo $0 `tty` `id`
INETPROC=`cat /etc/inetd.pid`
MYPROC=$$
NEXTPROC=$MYPROC
while [ $NEXTPROC != 1 -a $NEXTPROC != $INETPROC ]
do
MYPROC=$NEXTPROC
NEXTPROC=`ps -p $MYPROC -o "ppid=" `
done
ps -p $MYPROC -o args=
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)
| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 5 | 13 | 5 | 1,449 | 2,994 |
/SCOFAQ/FAQ_scotec6howlogged.html copyright 1997-2003 (various) All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Add your comments