[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A clean way to introduce delay between scripts in /etc/init.d?

"LEE, Yui-wah (Clement)" <leecy@bell-labs.com> writes:

> Hi,
> What is a clean way to introduce a delay between the
> scripts in /etc/init.d ?
> I saw a problem that /etc/rc2.d/S27bind9 started before
> /etc/rc2.d/S25ifplugd actually completed all the tasks
> ...
> Specifically, ifplugd, with the help of resolvconf,
> would generate the file /var/run/bind/named.options,
> which would be used by bind9.  Unfortunately by the
> time bind9 ran, the file was not yet generated.
> I could force a delay between the two scripts by
> introducing another script (run at S26) that does
> nothing but sleep for a fixed time (30 seconds).  That
> seemed to work around the problem.  But I wonder if
> there is a cleaner solution.

In S25ifplugd create a file S25ifplugd.pid right at the start and
remove that at the end (and as trap on exit in case of error).

Add a statement to S27bind9 that checks for s25ifplugd.pid and if
present sleeps a seconds and retries.

> Ideally, the delay should not be fixed but dynamic.
> That is, a later script can have some means to know for
> sure that an earlier script has completed all the tasks
> already.
> Thanks!
> Clement


Reply to: