Bug#727708: upstart and upgrading from sysvinit scripts
Steve Langasek <vorlon@debian.org> writes:
> On Sat, Dec 28, 2013 at 04:45:38PM -0800, Russ Allbery wrote:
>> After some more experimentation (the documentation doesn't say clearly
>> whether pre-start can expose environment variables to exec or not), it
>> looks like a better approach is:
>> expect stop
>> pre-start script
>> test -x /usr/sbin/lbcd || { stop; exit 0; }
>> if [ -f /etc/default/lbcd ] ; then
>> . /etc/default/lbcd
>> fi
>> end script
>> # To change the default lbcd service, specify a command to run for the
>> # weight and interval, or do round-robin (-R), set the desired flags
>> # in DAEMON_OPTS in /etc/default/lbcd.
>> exec /usr/sbin/lbcd -f -l -Z $DAEMON_OPTS
>> This seems to work and is what I will be uploading.
> Hmm, It seems to not be what you uploaded in practice... which stands to
> reason, since in fact no, the pre-start script cannot export environment
> variables to the main process (for standard unixy reasons - upstart
> doesn't do anything magical here to try to tie the process environments
> together, so when the pre-start script exits, its environment goes with
> it. This could be documented better). I guess you figured this out
> after having written this mail?
Yes, indeed, sorry, that's correct. This is the mail message that got
stuck behind the buggy virus definition, and I forgot to go back and
update it with the current results. What I uploaded went back to using a
script for the whole thing:
pre-start script
test -x /usr/sbin/lbcd || { stop; exit 0; }
end script
# To change the default lbcd service, specify a command to run for the
# weight and interval, or do round-robin (-R), add the flags to
# DAEMON_OPTS in /etc/default/lbcd. This will ensure consistent
# behavior across all init systems.
script
if [ -f /etc/default/lbcd ] ; then
. /etc/default/lbcd
fi
exec /usr/sbin/lbcd -f -l -Z $DAEMON_OPTS
end script
--
Russ Allbery (rra@debian.org) <http://www.eyrie.org/~eagle/>
Reply to: