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.
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.