Finding name of script file that signaled my process


 
Thread Tools Search this Thread
Operating Systems AIX Finding name of script file that signaled my process
# 1  
Old 10-04-2010
Finding name of script file that signaled my process

Is there a way to find out the path/name of a script file that signaled my process? All that shows up from the signal info data is ksh. Even in getprocs64 is is just ksh. I am not sure why the full path and file name are not showing up instead of the shell name. I tried ptrace64 with PT_LDINFO but cannot get past and EBADF error. So, any suggestions would be appreciated.
# 2  
Old 10-04-2010
Your invoker is the pid in $PPID, and you can run ps in a popen() or something C library equivalent to find out about it. The second parameter is the script. The effect of starting a script with the line:

Code:
#!<path_to_interpreter> [ optional_one_arg ]

is that exec() effectively executes a command:

Code:
<path_to_interpreter> [ optional_one_arg ] $@

The optional_one_arg is nice with things like sed that need -f to make it work. See man exec or run "truss -fae <some_script>" or the like.

Last edited by Scott; 10-05-2010 at 11:25 AM.. Reason: Code tags, please...
# 3  
Old 10-05-2010
Thanks DG, but I am not looking for my invoker, I already know that one. I am looking for the name of the script file that sent me a signal 15. We have several scripts that look for my specific process to send it a signal via "kill" in AIX and I need to find the name of the one that sent it to me. Is this information lost? I have tried "ps" and "getprocs64" but they both have just "ksh" as the description of the process.

I know we could probably change our scripts to write a file or something which I could then look for, but I am trying to make the change in one place.
# 4  
Old 10-05-2010
Right, signalled, sorry, so you have the pid, the ps command will do it but you need to ask for the entire command line with "-o args" or "-f".
This User Gave Thanks to DGPickett For This Post:
# 5  
Old 10-05-2010
Thanks DG, that did it. I appreciate the help. I forgot ps won't display the whole description without -f.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding a file process ?

Hi, I am trying to find a file that have a different name than it should be processing, the file name is ( Fifa15 ) is there a command to use? I got that file by ps -ef | grep fifa15 but how do I know what is running ? thanks a lot, I am learning unix so sorry if that is a... (2 Replies)
Discussion started by: latinooo
2 Replies

2. Shell Programming and Scripting

Finding process which ended another process

Hello, The scenario is as follows, I have a background process running initially for which i know the PID on machine1. I use ssh from machine 2 to execute a script in machine 1. For some reason the back ground process is terminated. I would like to know which process caused the... (6 Replies)
Discussion started by: prasbala
6 Replies

3. UNIX for Dummies Questions & Answers

Finding a rogue process

Afternoon all, hopefully someone can give me a hand with this (the following may be explained very poorly :rolleyes: ) I know there's a process running on one of our Solaris 10 boxes that runs approximately every 5 minutes. Unfortunately I've no idea, who owns it, what it is called, or how it is... (2 Replies)
Discussion started by: dlam
2 Replies

4. UNIX for Advanced & Expert Users

Finding process id of subsequent process

hi all, I am trying to find the process id of the subsequent process created via fork and exec calls in perl. For eg: envVarSetter dataCruncher.exe < input.txt > output.txt When I fork and exec the above command, it returns only the pid of envVarSetter and I don't know how to find the... (9 Replies)
Discussion started by: matrixmadhan
9 Replies

5. Shell Programming and Scripting

Finding the process id of the process using the ports

Hi Any idea how to get the process id of the process using the ports lsof -i :portnumber does not work in my machine. I am on sun Solaris SPARC. Any suggestion is highly appreciated (1 Reply)
Discussion started by: kinny
1 Replies

6. Shell Programming and Scripting

Non-interactive shell leaves children running when signaled by TERM

Hello. When I run sh -c 'yes'and then send SIGTERM to sh's pid, both sh and yes dies. When I run sh -c 'yes | sed "s/y/n/"'and then send SIGTERM to sh's pid, sh dies but yes and sed remain running in background with init as the parent. Why? I bash man page is stated that when bash... (0 Replies)
Discussion started by: woky
0 Replies

7. Linux

Need help in finding process

Hello, Iam running a apache webserver in CentOS recenlty a hacker has attacked my server using RFI attack and did something in my server.. After that everyday at 8Pm my httpd is using about 5000 pid's actually in normal it takes only about 30 - 40 pid's. and also exim uses 2000 pid's totally my... (2 Replies)
Discussion started by: dheeraj4uuu
2 Replies

8. Shell Programming and Scripting

awk script required for finding records in 1 file with corresponding another file.

Hi, I have a .txt file (uniqfields.txt) with 3 fields separated by " | " (pipe symbol). This file contains unique values with respect to all these 3 fields taken together. There are about 40,000 SORTED records (rows) in this file. Sample records are given below. 1TVAO|OVEPT|VO... (2 Replies)
Discussion started by: RRVARMA
2 Replies

9. UNIX for Dummies Questions & Answers

Finding out process id in a scipt

Hi, If in a shell script i write a command ls > bla & ls The output is redirected to bla and the next ls starts as first one is going on in background. I want to find the PID of the first command. Thanks in advance (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

10. UNIX for Dummies Questions & Answers

finding process id

is there a way to find the process id of a process because i have same process invoked several times. when i need to kill them, i get confused with the id. Thanks, sskb :( (8 Replies)
Discussion started by: sskb
8 Replies
Login or Register to Ask a Question