1748225 Members
4519 Online
108759 Solutions
New Discussion юеВ

Script owner

 
Unix or Linux?
Frequent Advisor

Script owner

How can I find the user name of the person who is executing a particular script.

For example: who is executing Script1
5 REPLIES 5
A. Clay Stephenson
Acclaimed Contributor

Re: Script owner

ps -ef | grep "Script1"
If it ain't broke, I can fix that.
Ninad_1
Honored Contributor

Re: Script owner

Hi,

If the script is being currently executed then
1. you can do a ps -eaf | grep script1
This would show you teh person executing
2. If you know thw full pathname of the script you can also do
fuser -u /path/script1
This will show which users have opened the file for use.

Regards,
Ninad
Unix or Linux?
Frequent Advisor

Re: Script owner

Thank you
James R. Ferguson
Acclaimed Contributor

Re: Script owner

Hi:

If you happen to be able to look at the process list at the time the script is executing, then you could determine "who".

# UNIX95= ps -fC yourscript

If you want, you could add code to your script to log the user who runs it. SOmething as simple as:

# echo "`date` via `id`" >> $HOME/mytrace

Otherwise, you would be forced to enable full system auditing.

Regards!

...JRF...
Unix or Linux?
Frequent Advisor

Re: Script owner

Thank you