Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!ncar!midway!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.shell Subject: Re: Automated logins and file transfers from a KSh script ? Keywords: cron, cu, VAX, VMS, HP UX, Kermit Message-ID: <1991Feb13.221007.12722@chinet.chi.il.us> Date: 13 Feb 91 22:10:07 GMT References: <228@nos850.UUCP> Organization: Chinet - Chicago Public Access UNIX Lines: 39 In article <228@nos850.UUCP> joem@nos850.UUCP (Joe Muller) writes: > > > I am attempting to write a Korn Shell script for a cron that would automate >the kermiting of files from a VAX/VMS system to an HP UX system. So far I >have had very limited success; it can cu to our modem (/dev/ttyAp5), and >after removing the LCK file, it echoes commands to the modem. So far I have >been able to get it to successfuly dial out from a script, but what I have been >having problems with is getting it to wait for a proper response before >echoing the next command to the modem. I have tried cu'ing to the modem with >this command: > cu -l/dev/ttyAp5 -s2400 | tee -a log > >and then taking the response from the other machine as being the last line in >the file 'log.' However, I am having difficulties in getting this to work >correctly. What I would like to do is write an 'expect' command that >would have the script wait for a proper response from a command echoed to >the device. I could always just have the script sleep inbetween commands, but >this assumes that the connection has already been made. If anybody has >done something similiar to this, or can offer any advice or suggestions, >please post them here. If you have a recent version of kermit, it should have a "script" command and be capable of initiating the connection all by itself without any help from cu. It can also do shell escapes from within its command mode so you can transfer a file in and then let a shell script parse the filename and generate your next action by writing a temp file of kermit commands which the top-level script executes via the "take" command. Oddly, there isn't a command line option to tell kermit to run non-interactively from a command file, so you have to redirect stdin for the main script which can just be a stack of "take" commands to do each operation. If it's just a straightforward file transfer the script can be pretty simple. I've been moving files between a unix box and an IBM running VM/CMS this way for several years, using a simple naming convention to decide what to do after the transfer. It's ugly but the price was right and it pretty much takes care of itself. Les Mikesell les@chinet.chi.il.us