Thank you. I found the cause of the problem: the daemon changed its process name after start so the value in /var/run/rc.d file was wrong. That is why the stop script didn't work (actually it appeared that start script was working correctly). I set up correct pexp value and everything worked fine.
Let us consider this as solved. Sorry for bothering. On Tue, Sep 25, 2012 at 11:51 PM, Stuart Henderson <[email protected]>wrote: > On 2012-09-25, Victor Leschuk <[email protected]> wrote: > > Hello all, > > > > I am trying to create an rc.d script for my application. Current code > looks > > like the following: https://gist.github.com/3783889 . The man for > rc.subr > > says that I can override rc_* functions as well as pexp variable. However > > with the script above commands like: > > > > /etc/rc.d/my_daemon stop > > > > do not call overridden functions (it can be seen in sh -x and if you > place > > echo in function body). Also I noticed that stop handler (default one as > > overridden isn't called) ignored my pexp value and passed just > "^${daemon}" > > to pkill. What am I doing wrong? > > In general this works fine, many examples in the tree use this > successfully. > > What you show, with the "/path/to/daemon" etc and "my_daemon" > filename does not seem likely to be the real path/name, so it would > be better to show *exactly* what you're doing.

