[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: Adrian Perez de Castro <aperez@...>
- Date: Fri, 9 Apr 2021 00:19:50 +0300
On Thu, 08 Apr 2021 15:25:29 -0500 Javier Guerra Giraldez <firstname.lastname@example.org> wrote:
> On Thu, 8 Apr 2021 at 13:22, Nicholas Joll <email@example.com> wrote:
> > I am told by the maintainers of the 'luaposix' module that, when running on Linux, lua can detect whether a process of a given name is running, in the manner of the Linux utility `pidof`.
> most of these utilities just traverse the /proc filesystem
You can try sending signal 0 to the process using the kill(2) system call.
The man page has this little gem:
"If sig is 0, then no signal is sent, but existence and permission checks
are still performed; this can be used to check for the existence of a
process ID or process group ID that the caller is permitted to signal."
I hope this helps :)
Description: PGP signature