Path: utzoo!utgpu!attcan!uunet!steinmetz!davidsen From: davidsen@steinmetz.ge.com (William E. Davidsen Jr) Newsgroups: comp.unix.wizards Subject: Re: Task sync Message-ID: <11681@steinmetz.ge.com> Date: 28 Jul 88 20:43:38 GMT References: <11658@steinmetz.ge.com> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Distribution: na Organization: General Electric CRD, Schenectady, NY Lines: 61 In article <11658@steinmetz.ge.com> I write: | | I have a problem which requires running a number of similar programs, | then a final program. It's not a make, but the solution might be applied | there, too. Well about 30 people have written to say that all I do is keep a PID table, so I guess I didn't clarify the question very well. What I need to do is something like the 'batch' command, in that the commands to be run will not be started by the same processes, at least on its own. I need to be able to handle a number of commands, possibly from a number of other programs, in a portable way. On SysV I have a kludge which reads a named pipe and when it gets a command it either starts a process to execute it or waits for an existing process to complete. I never worked on getting the status back to the submitter, because I don't seem to find named pipes on all (or even most) BSD systems. What I have now is more or less a daemon to run jobs, although I would be willing to implement almost anything which will work. I certainly don't mind having some code which is used for BSD and some for SysV, but I don't want to use non-portable features and have every few lines be more stuff in an ifdef. Here's one way to use it: for file in *.mu do runsome -3 ioproc $file # ^^^^^^^ A ^^^^^^^^^^^^^^^^ # what I need | the command # max to run done runwait ^^^^^^^ # wait for all to stop It could also go in a make file: # compile three at a time .c.o: runsome -3 $(CC) $< -c prog: $(OBJFILES) runwait cc $(LFLAGS) $(OBJFILES) -o prog what I have now is more or less: pipename=`runsome 3` # run just three for file in *.c do echo "indent ${file}" > ${pipename} done runwait ${pipename} Thanks again to all who responded, I mailed thanks to all but some bounced, and hopefully this time I have explained better. -- bill davidsen (wedu@ge-crd.arpa) {uunet | philabs | seismo}!steinmetz!crdos1!davidsen "Stupidity, like virtue, is its own reward" -me