![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| executing shell file in jva + tomcat | jaganadh | Shell Programming and Scripting | 1 | 10-20-2007 03:58 PM |
| executing a binary file | Terrible | Shell Programming and Scripting | 5 | 08-15-2006 09:00 AM |
| Find the user executing a script | Chiefos | UNIX for Dummies Questions & Answers | 2 | 06-14-2006 12:40 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 02:25 AM |
| problem in executing a file | i2admin | UNIX for Advanced & Expert Users | 2 | 04-30-2003 11:38 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
How to find who is executing a file.
Suppose there is a file which is being executed by someone. Is there a way to return the username of whoever is using that file?
|
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
implement the logic within the code itself,
to call getlogin function to dump the user name (currently executing to some log file ) this will not take care of sudo users |
|
#3
|
||||
|
||||
|
You could also use the fuser command for this.
Code:
fuser -fu /file/being/executed |
|
#4
|
|||
|
|||
|
Thanks for your reply. Now all I have to do is figure out how to use getlogin()
|
|
#5
|
|||
|
|||
|
On a lot of systems where fuser is not available lsof will work.
By execute you mean "open" by another process, right? Or are you talking about locking files -- stopping your process from opening the file when it's already open? |
|
#6
|
|||
|
|||
|
The answers we gave are shell commands. Why do you need getlogin()?
|
|
#7
|
|||
|
|||
|
I'm a complete newbie at UNIX. I have an exercise to do where I have to find the username of someone executing a script and print it to another file. I was sort of hoping for a command like finger, where you put in a script name instead of a person, to find out who is using it.
|
|||
| Google The UNIX and Linux Forums |