Is there a function somewhere that will let me pass it the executable file name and it will return the pid (if its running)?
I thought I'd ask before writing a function to trawl through /proc/xxxx/cmdline for all processes.
This is a discussion on Get pid based on command within the Linux Programming forums, part of the Platform Specific Boards category; Is there a function somewhere that will let me pass it the executable file name and it will return the ...
Is there a function somewhere that will let me pass it the executable file name and it will return the pid (if its running)?
I thought I'd ask before writing a function to trawl through /proc/xxxx/cmdline for all processes.
What if the same executable is running several times?
Nothing springs to mind for what you want.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.