Reputation: 2553
I have a multiple process running at a time and only one of these process will execute a given shell script.
I do not have access to the source code of these processes, but I have access to the script which is getting called by one of the processes.
Is it possible to modify the script so that I know which process executes the script?
Upvotes: 0
Views: 819
Reputation: 656
You can echo the variable '$$'
which contains the PID.
then you can use lsof -p PID
to find who is running your script and what else is opened.
Also you can use lsof <path/to/your/script.sh>
to see which process is accessing your script.
Upvotes: 0