in reply to Re^4: Fork daemon from Perl script and save it's PID. How to do it right?
in thread Fork daemon from Perl script and save it's PID. How to do it right?

Yes, I know. I do exec() on daemon binary directly.
And that's the problem. If you just use the init scripts both for starting and stopping the daemon, you don't have to care about all this stuff. That's what the init scripts are for.
Is it clear enough?
Yes, the difficulties with your current approach are clear to me. But I don't see why you have to take this approach. When you ask how to start and stop daemons, I tell you how it's usually done. Why can't you use the daemon in a way that the standard techniques apply?
  • Comment on Re^5: Fork daemon from Perl script and save it's PID. How to do it right?

Replies are listed 'Best First'.
Re^6: Fork daemon from Perl script and save it's PID. How to do it right?
by accessdenied (Acolyte) on Nov 26, 2008 at 11:06 UTC
    Does init scripts return PID? I don't think so. They doesn't operate with PID even. Well, DHCP is not good example. Between others I have to start several instances of another daemon. Doesn't mater which one. It's source code can't be fixed too. It has the same "fork && exit" pair inside. And the same "wrong saved PID" problem too. Init scripts allow start one instance and I need several. Also I need to save PID to select which instance to stop on request. Standard approach doesn't work here, as I think. Do you have any more suggestions?