rc.d script for perl service

I'm trying to create a rc.d script for a Perl service. The perl script can restart it self. It does that by executing exec $^X ...[1]. The problem is that when it is first started it uses the shebang to execute Perl which results in a ps entry like /usr/bin/perl /path/to/myScript.pl but after the restart the ps entry is /usr/local/bin/perl5 /path/to/myScript.pl. That confuses the rc.subr() routines and it cannot detect the running program anymore.

The Perl script is able to provide a correct PID file at any time but the check_pidfile routine also checks the executable name which only works if command_interpeter is set to /usr/bin/perl.

Does anyone have any idea how to proceed from here?

[1] http://perldoc.perl.org/perlvar.html#$EXECUTABLE_NAME
 
Not certain here...

But there is declaration in rc.conf indicating that changes in rc.conf are overwritten by declarations in rc.conf.local. So, when you say, "upon restart..." the process (ps) result changes and script fails. Maybe, you need to create entries into rc.conf.local to assure your script directives are not lost/reset by rc.conf upon restart.

And/or maybe create symbolic links between /usr/bin/perl and usr/local/bin/perl5.
 
Back
Top