[Date Prev] [Date Index] [Date Next] [Thread Prev] [Thread Index] [Thread Next]
Bryan Stansell bryan@conserver.com
Thu, 17 Jan 2002 00:37:46 -0800
On Tue, Jan 15, 2002 at 01:55:52PM -0500, Greg A. Woods wrote: > I thought, oh, this should be easy, I'll just "echo f | console -f ups" > using a user-ID that doesn't require a password and be done with it. > > Unfortunately when I tried that the conserver daemon came crashing down > claiming to have suffered an unexpected SIGPIPE. This was not a > pleasant experience since it was my main production conserver! :-( hmm...i just tried that myself (well, 'echo ls | console -f foo4') and it didn't crash (using conserver-7.1.4-beta). the client didn't see the output of ls, but the logfile has it. what version of conserver and what type of host are you using (solaris 7, myself)? > Ideally I'd like to also have "console" show the resulting output on > stdout, say up to the next prompt (it would send a <CR> or whatever is > specified to determine what the prompt string is), or for some specified > number of lines, or up to the end of some specified regular expression, > etc. > > Has anyone else thought of this, or have any suggestions? well, assuming we can get the thing from crashing with a SIGPIPE, you could do something like: (echo 'ls'; sleep 5) | console -f ups as long as you don't close stdin of the client you'll be able to see the output (worked for me, anyway). using this as a base, you could write a wrapper that fed data to the console client and read it's output. as long as you kept the feed open and only closed it once you saw the regexp or CR or whatever coming out the other end, you should be able to do just about anything. heck, you could even do a whole expect-like thing and feed more commands based on the output and such. in theory, the perl IPC::Open2 module should provide at least one method of doing this (or the Expect module, or...). Bryan