[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: How to detect whether a process is running, on Linux, in the manner of 'pidof'?
- From: Nicholas Joll <nicholasjoll@...>
- Date: Fri, 9 Apr 2021 04:01:07 +0100
I have had a couple of replies and one of my respondents - when I
emailed him directly - suggested that I should respond to replies on
list. (I am new to this list. One of the few lists that I used
before wanted replies off-list.)
So . .
Another person suggested that I somehow query Linux's /proc
filesystem. The idea was: that is what pidof does. Well, I know how
to do elementary file-handing in lua, but what do I seek in /proc?
Surely there's an easier way for me to tell whether a process is
running than by determining how pidof works and reimplementing its C
code, myself, in lua. (Please note also that, as I said in my first
email, I do not want to call pidof _from_ lua. That is what my code
does already, and it works, but so doing uses too many resources for
One respondent suggested that I could 'try sending signal 0 to the
process using the kill(2) system call'. OK; but how do I do that in
lua? I see (from
this documentation) that the luaposix module has a 'kill'
command. So, so long as I can get an informative number back from
that call, it should work. I will try it.