Problem with Kermit spawned from Expect script sending files - Protocols

This is a discussion on Problem with Kermit spawned from Expect script sending files - Protocols ; I have the following lines from my EXPECT script, which first spawns KERMIT, but it is failing trying to get a file called testfile.txt This is part of the script: .. .. cd /home expect { "#" { send "send ...

+ Reply to Thread
Results 1 to 16 of 16

Thread: Problem with Kermit spawned from Expect script sending files

  1. Problem with Kermit spawned from Expect script sending files

    I have the following lines from my EXPECT script, which first spawns
    KERMIT, but it is failing trying to get a file called testfile.txt


    This is part of the script:

    ..
    ..
    cd /home
    expect {
    "#" {
    send "send *.*\r"
    expect {
    "#" {
    send "rm *.*\r"
    ..
    ..


    I get this error message when I run it interactively:

    "send: unable to stat draft file /root/Mail/testfile.txt: No such file
    or directory"

    I'm not sure why it is looking in the /root/Mail directory for this
    file.

    Also, doesn't the KERMIT Send command have a /delete option to delete
    after succesful transfer ?

    Thanks.

  2. Re: Problem with Kermit spawned from Expect script sending files

    In article ,
    newexpectuser wrote:
    : I have the following lines from my EXPECT script, which first spawns
    : KERMIT, but it is failing trying to get a file called testfile.txt
    :
    If you are using Kermit, you don't need to use Expect. Just do it all
    as a Kermit script. Mixing Kermit and Expect only causes needless
    complications. For a bit more explanation, read the beginning of:

    http://www.columbia.edu/kermit/ftpscripts.html

    Although it's a page about our FTP client, the explanatory points apply
    just as well to your application.

    - Frank

  3. Re: Problem with Kermit spawned from Expect script sending files

    I like using EXPECT, because I am familiar with it and what I am
    trying to do is very simple (get a file over from our secure ftp site
    to another server).

    EXPECT allows me to pass a password across from the internal server
    (non-secure), which I like and need.

    I like KERMIT, because I read that it can send a file, then delete it
    after it was successfully transfered. I know FTP can do this in
    Kermit, but I'm not sure why when I do this send it is failing.

    Frank da Cruz wrote in message news:...
    > In article ,
    > newexpectuser wrote:
    > : I have the following lines from my EXPECT script, which first spawns
    > : KERMIT, but it is failing trying to get a file called testfile.txt
    > :
    > If you are using Kermit, you don't need to use Expect. Just do it all
    > as a Kermit script. Mixing Kermit and Expect only causes needless
    > complications. For a bit more explanation, read the beginning of:
    >
    > http://www.columbia.edu/kermit/ftpscripts.html
    >
    > Although it's a page about our FTP client, the explanatory points apply
    > just as well to your application.
    >
    > - Frank


  4. Re: Problem with Kermit spawned from Expect script sending files

    Frank,

    I looked at the article and have tried this simple connection:

    #!/usr/bin/kermit +
    echo "Starting"
    set host /pipe ssh -e none -l /user:root 111.111.11.111
    lineout "mypassword"
    echo "Connected"
    quit


    With this above it does connect, but still waits for me to enter a
    password, I thought the lineout would do this for me, that is why I
    had mentioned EXPECT earlier, it can pass this value via the "send"
    command in EXPECT.

    Tony
    Frank da Cruz wrote in message news:...
    > In article ,
    > newexpectuser wrote:
    > : I have the following lines from my EXPECT script, which first spawns
    > : KERMIT, but it is failing trying to get a file called testfile.txt
    > :
    > If you are using Kermit, you don't need to use Expect. Just do it all
    > as a Kermit script. Mixing Kermit and Expect only causes needless
    > complications. For a bit more explanation, read the beginning of:
    >
    > http://www.columbia.edu/kermit/ftpscripts.html
    >
    > Although it's a page about our FTP client, the explanatory points apply
    > just as well to your application.
    >
    > - Frank


  5. Re: Problem with Kermit spawned from Expect script sending files

    In article ,
    newexpectuser wrote:
    : I like using EXPECT, because I am familiar with it and what I am
    : trying to do is very simple (get a file over from our secure ftp site
    : to another server).
    :
    : EXPECT allows me to pass a password across from the internal server
    : (non-secure), which I like and need.
    :
    If Expect can pass the password to your SSH client, then so can Kermit.
    See:

    http://www.columbia.edu/kermit/ckermit70.html#x2.7

    (and its subsections).

    : I like KERMIT, because I read that it can send a file, then delete it
    : after it was successfully transfered. I know FTP can do this in
    : Kermit, but I'm not sure why when I do this send it is failing.
    :
    It will fail if deletion is not allowed by your access rights over the file.

    Of course different methods are required for a Kermit client/server and
    FTP connections. If you want an analysis of why it's failing, you'll need
    to send the details to:

    kermit-support@columbia.edu

    - Frank

  6. Re: Problem with Kermit spawned from Expect script sending files

    In article ,
    newexpectuser wrote:
    :
    : I looked at the article and have tried this simple connection:
    :
    : #!/usr/bin/kermit +
    : echo "Starting"
    : set host /pipe ssh -e none -l /user:root 111.111.11.111
    : lineout "mypassword"
    : echo "Connected"
    : quit
    :
    : With this above it does connect, but still waits for me to enter a
    : password, I thought the lineout would do this for me, that is why I
    : had mentioned EXPECT earlier, it can pass this value via the "send"
    : command in EXPECT.
    :
    What if you use "set host /pty" instead of "set host /pipe"? Expect uses
    ptys, so if you tell Kermit to use a pty, it should work like Expect.

    - Frank

  7. Re: Problem with Kermit spawned from Expect script sending files

    I tried the /pty, but when I run it (via ./scriptname.sh), it puts me
    at a "C-Kermit>" prompt ?
    Frank da Cruz wrote in message news:...
    > In article ,
    > newexpectuser wrote:
    > :
    > : I looked at the article and have tried this simple connection:
    > :
    > : #!/usr/bin/kermit +
    > : echo "Starting"
    > : set host /pipe ssh -e none -l /user:root 111.111.11.111
    > : lineout "mypassword"
    > : echo "Connected"
    > : quit
    > :
    > : With this above it does connect, but still waits for me to enter a
    > : password, I thought the lineout would do this for me, that is why I
    > : had mentioned EXPECT earlier, it can pass this value via the "send"
    > : command in EXPECT.
    > :
    > What if you use "set host /pty" instead of "set host /pipe"? Expect uses
    > ptys, so if you tell Kermit to use a pty, it should work like Expect.
    >
    > - Frank


  8. Re: Problem with Kermit spawned from Expect script sending files

    In article ,
    newexpectuser wrote:
    : I tried the /pty, but when I run it (via ./scriptname.sh), it puts me
    : at a "C-Kermit>" prompt ?
    :
    Here's a script that works for me:

    #!/usr/bin/kermit +
    ;
    ; Using OpenSSH_3.7.1p2...
    ;
    set host /pty ssh -e none -l \v(userid) \%1
    if fail stop 1
    input 20 password:
    if success lineout \%2

    In this script, \%1 is the hostname or address and \%2 is the password.

    I suspect your script did not wait for the "password:" prompt and the
    ssh client does not allow typeahead.

    - Frank

  9. Re: Problem with Kermit spawned from Expect script sending files

    In article , Frank da Cruz wrote:
    : In article ,
    : newexpectuser wrote:
    :: I tried the /pty, but when I run it (via ./scriptname.sh), it puts me
    :: at a "C-Kermit>" prompt ?
    ::
    : Here's a script that works for me:
    :
    : #!/usr/bin/kermit +
    : ;
    : ; Using OpenSSH_3.7.1p2...
    : ;
    : set host /pty ssh -e none -l \v(userid) \%1
    : if fail stop 1
    : input 20 password:
    : if success lineout \%2
    :
    : In this script, \%1 is the hostname or address and \%2 is the password.
    :
    : I suspect your script did not wait for the "password:" prompt and the
    : ssh client does not allow typeahead.
    :
    I forgot to add, in case it is not obvious, that the script will return
    to the C-Kermit> when it has no more commands to execute, unless it
    executes an EXIT or QUIT command.

    The script fragment above, then, will return to the C-Kermit> prompt because
    it has no more commands to execute. Thus you must continue the script
    to do whatever you want it to do, for example:

    (wait for shell prompt)
    lineout "kermit -x" ; Start Kermit server
    rcd somedirectory ; CD to some directory on the host
    send /delete somefile ; "move" a file from here to there
    bye ; Shut down and log out the server
    exit ; Exit from local Kermit program

    - Frank

  10. Re: Problem with Kermit spawned from Expect script sending files

    Frank da Cruz wrote in message news:...
    > In article , Frank da Cruz wrote:
    > : In article ,
    > : newexpectuser wrote:
    > :: I tried the /pty, but when I run it (via ./scriptname.sh), it puts me
    > :: at a "C-Kermit>" prompt ?
    > ::
    > : Here's a script that works for me:
    > :
    > : #!/usr/bin/kermit +
    > : ;
    > : ; Using OpenSSH_3.7.1p2...
    > : ;
    > : set host /pty ssh -e none -l \v(userid) \%1
    > : if fail stop 1
    > : input 20 password:
    > : if success lineout \%2
    > :
    > : In this script, \%1 is the hostname or address and \%2 is the password.
    > :
    > : I suspect your script did not wait for the "password:" prompt and the
    > : ssh client does not allow typeahead.
    > :
    > I forgot to add, in case it is not obvious, that the script will return
    > to the C-Kermit> when it has no more commands to execute, unless it
    > executes an EXIT or QUIT command.
    >
    > The script fragment above, then, will return to the C-Kermit> prompt because
    > it has no more commands to execute. Thus you must continue the script
    > to do whatever you want it to do, for example:
    >
    > (wait for shell prompt)
    > lineout "kermit -x" ; Start Kermit server
    > rcd somedirectory ; CD to some directory on the host

    I thought this command changed the directory on the remote system. I
    have most of this working (including connecting now), however once I
    get connected to the remote server, I want to change into a specific
    directory on the remote server and I tried the rcd and do a ls -ltr
    command, but it gives me my directory where I execute the script
    (local machine) ?
    > send /delete somefile ; "move" a file from here to there
    > bye ; Shut down and log out the server
    > exit ; Exit from local Kermit program
    >
    > - Frank


  11. Re: Problem with Kermit spawned from Expect script sending files

    In article ,
    newexpectuser wrote:
    : Frank da Cruz wrote:
    :> ...
    :> The script fragment above, then, will return to the C-Kermit> prompt because
    :> it has no more commands to execute. Thus you must continue the script
    :> to do whatever you want it to do, for example:
    :>
    :> (wait for shell prompt)
    :> lineout "kermit -x" ; Start Kermit server
    :> rcd somedirectory ; CD to some directory on the host
    :
    : I thought this command changed the directory on the remote system.
    :
    It does.

    : I have most of this working (including connecting now), however once I
    : get connected to the remote server, I want to change into a specific
    : directory on the remote server and I tried the rcd and do a ls -ltr
    : command, but it gives me my directory where I execute the script
    : (local machine) ?
    :
    If a command does something that surprises you, give a HELP command for
    it to see its documentation:

    C-Kermit>help ls

    Syntax: LS [ args ]
    Runs "ls" with the given arguments.

    C-Kermit>help rdirectory

    RDIRECTORY is a short form of REMOTE DIRECTORY.

    C-Kermit>help remote directory

    Syntax: REMOTE DIRECTORY [ filespec ]
    Asks the Kermit or FTP server to provide a directory listing of the named
    file(s) or if no file specification is given, of all files in its current
    directory. Synonym: RDIR.

    C-Kermit>help directory

    Syntax: DIRECTORY [ switches ] [ filespec [ filespec [ ... ] ] ]
    If LOCUS is REMOTE or LOCUS is AUTO and you have an FTP connection,
    this command is equivalent to REMOTE DIRECTORY (RDIR). Otherwise:

    Lists local files. The filespec may be a filename, possibly containing
    wildcard characters, or a directory name. If no filespec is given, all
    files in the current directory are listed. If a directory name is given,
    all the files in it are listed. Multiple filespecs can be given.
    Optional switches:

    /BRIEF List filenames only.
    /VERBOSE + Also list permissions, size, and date.
    /FILES Show files but not directories.
    /DIRECTORIES Show directories but not files.
    /ALL + Show both files and directories.
    /ARRAY:&a Store file list in specified array (e.g. \%a[]).
    /PAGE Pause after each screenful.
    /NOPAGE Don't pause after each screenful.
    /DOTFILES Include files whose names start with dot (period).
    /NODOTFILES + Don't include files whose names start with dot.
    /FOLLOWLINKS Follow symbolic links.
    /NOFOLLOWLINKS + Don't follow symbolic links.
    /BACKUP + Include backup files (names end with .~n~).
    /NOBACKUPFILES Don't include backup files.
    /OUTPUT:file Store directory listing in the given file.
    /HEADING Include heading and summary.
    /NOHEADING + Don't include heading or summary.
    /SUMMARY Print only count and total size of matching files.
    /XFERMODE Show pattern-based transfer mode (T=Text, B=Binary).
    /TYPE: Show only files of the specified type (text or binary).
    /MESSAGE:text Add brief message to each listing line.
    /NOMESSAGE + Don't add message to each listing line.
    /NOXFERMODE + Don't show pattern-based transfer mode
    /ISODATE + In verbose listings, show date in ISO 8061 format.
    /ENGLISHDATE In verbose listings, show date in "English" format.
    /RECURSIVE Descend through subdirectories.
    /NORECURSIVE + Don't descend through subdirectories.
    /SORT:key Sort by key, NAME, DATE, or SIZE; default key is NAME.
    /NOSORT + Don't sort.
    /ASCENDING + If sorting, sort in ascending order.
    /REVERSE If sorting, sort in reverse order.

    Factory defaults are marked with +. Default for paging depends on SET
    COMMAND MORE-PROMPTING. Use SET OPTIONS DIRECTORY [ switches ] to change
    defaults; use SHOW OPTIONS to display customized defaults.

    - Frank

  12. Re: Problem with Kermit spawned from Expect script sending files



    newexpectuser wrote:

    >> (wait for shell prompt)
    >> lineout "kermit -x" ; Start Kermit server
    >> rcd somedirectory ; CD to some directory on the host

    >
    > I thought this command changed the directory on the remote system. I
    > have most of this working (including connecting now), however once I
    > get connected to the remote server, I want to change into a specific
    > directory on the remote server and I tried the rcd and do a ls -ltr
    > command, but it gives me my directory where I execute the script
    > (local machine) ?


    try using REMOTE DIRECTORY or its shortened form, RDIR

    >
    >> send /delete somefile ; "move" a file from here to there
    >> bye ; Shut down and log out the server
    >> exit ; Exit from local Kermit program
    >>
    >>- Frank


    Arthur.

  13. Re: Problem with Kermit spawned from Expect script sending files

    Arthur Marsh wrote in message news:<3fafafd0$1@yorrell.saard.net>...
    > newexpectuser wrote:
    >
    > >> (wait for shell prompt)
    > >> lineout "kermit -x" ; Start Kermit server
    > >> rcd somedirectory ; CD to some directory on the host

    > >
    > > I thought this command changed the directory on the remote system. I
    > > have most of this working (including connecting now), however once I
    > > get connected to the remote server, I want to change into a specific
    > > directory on the remote server and I tried the rcd and do a ls -ltr
    > > command, but it gives me my directory where I execute the script
    > > (local machine) ?

    >
    > try using REMOTE DIRECTORY or its shortened form, RDIR

    I tried the RDIR and then a ls command to make sure i was in the
    remote directory, but I got the local directory listing, unless my ls
    command only shows the local directory ?..I am also running this first
    from a command line in Unix using ./script.sh.
    >
    > >
    > >> send /delete somefile ; "move" a file from here to there
    > >> bye ; Shut down and log out the server
    > >> exit ; Exit from local Kermit program
    > >>
    > >>- Frank

    >
    > Arthur.


  14. Re: Problem with Kermit spawned from Expect script sending files

    In article ,
    newexpectuser wrote:
    : Arthur Marsh
    : wrote in message news:<3fafafd0$1@yorrell.saard.net>...
    :> newexpectuser wrote:
    :> try using REMOTE DIRECTORY or its shortened form, RDIR
    :
    : I tried the RDIR and then a ls command to make sure i was in the
    : remote directory, but I got the local directory listing, unless my ls
    : command only shows the local directory ?..I am also running this first
    : from a command line in Unix using ./script.sh.
    :
    RDIR, LS, and DIRECTORY are three different commands. Each one does a
    different thing. Only RDIR requests a directory listing from the remote
    server.

    In a file transfer and management system such as Kermit (or, for that
    matter, FTP) there needs to be a way to refer to both local and remote
    files. By default, unprefixed commands such as DELETE, DIRECTORY, RENAME,
    etc, refer to local files. If you prefix them with the word REMOTE, or
    use the R-shortcuts (RDEL, RDIR, RREN, etc), they apply to remote files.

    For completeness and symmetry, there are also L-shortcuts to force reference
    to local files: LDEL, LDIR, LREN, etc.

    You can even have Kermit change the default for unprefixed commands; for
    example, to make it act like FTP:

    SET LOCUS REMOTE

    Then unprefixed file management commands refer to remote files. For more
    about this, see:

    http://www.columbia.edu/kermit/ckermit80.html#x3.4

    - Frank

  15. Re: Problem with Kermit spawned from Expect script sending files

    I tried the RDIR command, yet it still gave me the local directory
    listing, not the one off the remote server.
    Frank da Cruz wrote in message news:...
    > In article ,
    > newexpectuser wrote:
    > : Arthur Marsh
    > : wrote in message news:<3fafafd0$1@yorrell.saard.net>...
    > :> newexpectuser wrote:
    > :> try using REMOTE DIRECTORY or its shortened form, RDIR
    > :
    > : I tried the RDIR and then a ls command to make sure i was in the
    > : remote directory, but I got the local directory listing, unless my ls
    > : command only shows the local directory ?..I am also running this first
    > : from a command line in Unix using ./script.sh.
    > :
    > RDIR, LS, and DIRECTORY are three different commands. Each one does a
    > different thing. Only RDIR requests a directory listing from the remote
    > server.
    >
    > In a file transfer and management system such as Kermit (or, for that
    > matter, FTP) there needs to be a way to refer to both local and remote
    > files. By default, unprefixed commands such as DELETE, DIRECTORY, RENAME,
    > etc, refer to local files. If you prefix them with the word REMOTE, or
    > use the R-shortcuts (RDEL, RDIR, RREN, etc), they apply to remote files.
    >
    > For completeness and symmetry, there are also L-shortcuts to force reference
    > to local files: LDEL, LDIR, LREN, etc.
    >
    > You can even have Kermit change the default for unprefixed commands; for
    > example, to make it act like FTP:
    >
    > SET LOCUS REMOTE
    >
    > Then unprefixed file management commands refer to remote files. For more
    > about this, see:
    >
    > http://www.columbia.edu/kermit/ckermit80.html#x3.4
    >
    > - Frank


  16. Re: Problem with Kermit spawned from Expect script sending files

    In article ,
    newexpectuser wrote:
    : I tried the RDIR command, yet it still gave me the local directory
    : listing, not the one off the remote server.
    :
    That's not possible. We should take this discussion off the newsgroup.
    Send a copy of your script to kermit-support@columbia.edu and we'll take
    at a look at it.

    - Frank

+ Reply to Thread