schabacker@frambo.dec.com (CB, posted by generous Tim) (06/28/88)
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.
- <CB>
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.
-- __ __
/ / | \ \ <CB> 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!
keithd@cadovax.UUCP (06/28/88)
In article <8806271728.AA09747@decwrl.dec.com> schabacker@frambo.dec.com (CB, posted by generous Tim) writes: .... buncha stuff about AmiCron I take it then, that this approach: > (void)strcpy(doit,"RUN "); > (void)strcat(doit,command); (void)strcat(doit," >outfile "); (void)strcat(doit,"(parameters)"); Either wouldn't work or doesn't do what you want? Keith Doyle # {ucbvax,decvax}!trwrb!cadovax!keithd Contel Business Systems 213-323-8170
paolucci@snll-arpagw.UUCP (Sam Paolucci) (07/11/88)
In article <8807041819.AA21138@decwrl.dec.com> frambo::schabacker (Posted by Tim for <schabacker@frambo.dec.com>) writes: >Now Matt's stuff seem's to be more like it, he actually redirects the >CIS and COS handles. Although I still feel a little dizzy and have >that urgent desire for an aspirin after looking at Matts code, :-) >I think this will be the way to go. >It's in execom.c, where Matt does his magic to support pipes, if >inquiring minds wanna know. > > / / | \ \ <CB> 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 > "And now for something completely different..." Funny you should mentione it. I was looking at the same code 3 days ago in trying to implement "popen" on the amiga and I got that same dizzying feeling. By the way, I haven't got popen working yet, I had to get on something else, but I'll get back to it soon. By the way, if anyone has already crossed this path let me know. -+= SAM =+- "the best things in life are free" ARPA: paolucci@snll-arpagw.llnl.gov