Hi Guillem,

On Thu, May 07, 2026 at 08:53:34PM +0200, Guillem Jover wrote:
> On Sun, 2026-05-03 at 12:52:31 +0100, Andrew Bower wrote:
> > On Wed, Nov 15, 2023 at 01:00:04PM +0100, Guillem Jover wrote:
> > > On Tue, 2023-11-14 at 17:29:01 +1100, Craig Small wrote:
> > > > The majority of usage of pidof is in init or pre/post scripts, which 
> > > > really
> > > > should be using the LSB pidofproc function. That function in turn
> > > > optionally uses pidof if the pidfile parameter is not given. That's
> > > > probably a way forward for sometime in the future to not need 
> > > > procps-base
> > > > Essential, but it is a way off.
> > > 
> > > I think the status_of_proc function could be switched to use
> > > start-stop-daemon (s-s-d) --status instead of pidofproc. To replace
> > > pidof inside pidofproc I guess s-s-d could grow some option to print
> > > the pid, I'd be happy to implement that.
> > 
> > Thanks for this offer.
> > 
> > I wonder if this might well be worth doing if, as it sounds, it is a low
> > effort, low footprint change that simply allows any patch to swap out
> > pidof usage with a capability that will always be available regardless
> > of all else that happens in this transition?
> > 
> > In the pecking order of resolutions to improve an initscript this would
> > not be the first one I would go to but it would be handy to have in the
> > arsenal and above adding a dependency on the 2M procps.
> > 
> > Would this still be agreeable?
> 
> I just checked now and it was really trivial. I'm undecided whether to
> go with a new --print-pid command or an option to pass along the other
> commands to print the PIDs matche. I'm attaching both patches, and will
> be mulling over what feels like the better interface, before merging it
> and after adding proper man page updates, for the next dpkg release.

Thank you so much for knocking up these patches!

I literally just tried the first one, the new command, along with a
pidof() emulation function in /lib/lsb/init-functions, as a transparent
solution for all existing initscripts and it appeared to work very well!
I see the MBF just went through so we can't refer to this approach in
guidance but I think we might have a good way through here with this
enhancement.

Andrew

Reply via email to