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

Re: Sequential background tasks



On Mon, Jul 17, 2006 at 10:59:30AM +0200, T wrote:
> On Mon, 17 Jul 2006 00:10:43 -0500, Ron Johnson wrote:
> 
> >> I find that in many cases I need my background tasks to be executed in
> >> sequence. Ie, I need background task-b to start right after background
> >> task-a has properly started.
> >> 
> >> So far I haven't found a good way to do it. I used
> >> 
> >>  task-a & sleep 2; task-b &
> >> 
> >> but that 'sleep 2' has changed to 'sleep 5' and still sometimes task-b
> >> starts before task-a. I can raise the wait time, but it means that
> >> task-b would normally start too late...
> >> 
> >> Any good way?
> > 
> > "background" and "in sequence" are a bit (no, a *lot*) contradictory.
> 
> yeah, so true. 
> 
> hi, thanks everyone who replied.
> 
> > What you probably want is a *sequence* and put *it* in the background.
> > This, maybe:
> > 
> >   (task-a && sleep 2 && task-b) &
> 
> or as Cameron suggested
> 
> { task-a ; task-b ; } &
> 
> to avoid needlessly forking. 
> 
> This is the common theme for all the answers so far. But the problem is
> that my background tasks are real background tasks, eg. emacs and tk
> scripts, that they'd not finish and return. 

does this mean you need to start task-a, wait a little and then start
task b to run concurrently with task-a? 

A

Attachment: signature.asc
Description: Digital signature


Reply to: