Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!mit-eddie!husc6!purdue!decwrl!frambo.dec.com!schabacker From: schabacker@frambo.dec.com (CB, posted by generous Tim) Newsgroups: comp.sys.amiga.tech Subject: Re: RunBackGround vs. AmiCron Message-ID: <8806271728.AA09747@decwrl.dec.com> Date: 27 Jun 88 17:28:01 GMT Organization: Digital Equipment Corporation Lines: 72 In the original article Mike (I'm in a poetric mood) Meyer :-) complains that AmiCron is not a real background deamon and requires a window to operate. I'M CURRENTLY REWRITING AMICRON, THIS IS GOING TO BE FIXED, RSN. :-) BUT: Mike already pointed out the biggest problem involved with this, the redirection of the stdin (CIS), stdout (COS) filehandles. I've already made an AmiCron version that is a COMPLETE background task, however this is not going to be released, since I feel that the output of the invoked commands should be redirected to a file for inspection by the user. And there is were the trivial part ends. It's simple to direct all output to NIL: (via execute() filehandles and > < command redirection) but to write the output of the command(s) invoked to a file is unfortunately not. Why? Because command redirection can't append something to a file, and all commands invoked by AmiCron MUST be RUN'ed to prevent AmiCron from deadlock due to waiting for a command to finish. In this extract from an advanced AmiCron (void)strcpy(doit,"RUN "); (void)strcat(doit,command); /*Here we have to open the output file in an appending way*/ /*Finally the command gets executed, ouch :-)*/ (void)Execute(doit,NULL,fcrout); /*And here it get's closed again*/ Close(fcrout); } not the output of the command string gets redirected, but the RUN output (CLI[n]) is put to fcrout, and the command output appears at stdout (the original CLI window). Which is 100% OK, but very annoying in this case. There are (as far as I figure it) only two ways out of this: 1. Redirect stdin, stdout to a file by some un-documented, secret and possibly forbidden way, perhaps with the following pointers from the process structure: BPTR pr_CIS; /* Current CLI Input Stream */ BPTR pr_COS; /* Current CLI Output Stream */ or 2. Doing a fork() for each of the commands that has to be executed(), thus not having to RUN them and work happily and legally with the Execute() filehandles. I would love to hear any comments, specially to #1 from C-A or CATS (Andy, Carolyn, are you listening???). If I don't hear anything, I'll take route #2. -P.S. If there are more people out there currently hacking AmiCron to pieces, you're very welcome, but I would like it very much if you guys/gals would keep in touch with me, so that I can do some kind of coordination. Thanx. -- __ __ / / | \ \ aka Christian Balzer - The Software Brewery - // / / | \ \ UUCP : decwrl!{frambo|fra03|fra04}.dec.com!schabacker // < < |---< > or : schabacker@{frambo|fra03|fra04}.dec.com \\ // \ \ | / / CIS : 71001,210 (Be brief!) | Phone: +49 6150 4151 \X/ \ \__ |__/ / Snail: Im Wingertsberg 45, D-6108 Weiterstadt, F.R.G "Guess what? That's the news and I am out of here..." There are worse things than spelling errors, look at my grammar!