Delay in tcl proc

Clovertech Forums Read Only Archives Cloverleaf Tcl Library Delay in tcl proc

  • Creator
    Topic
  • #53456
    LaToya Butler
    Participant

      How can you cause a tcl proc to delay?  I’m executing an expect script, SFTP, to pick up multiple files from a remote server.  During the looping, the cloverleaf process hangs then stops.  

      My thread is set to an ‘Upoc’ and I’m using advance scheduling to execute the script at a particular time.  Again, it starts to execute but then stops.  Any ideas?  

      Here’s part of the script.

      Code:

         
                        # create expect script
         set es [open $esn w]
         puts $es “spawn sftp $user@$host”
         puts $es “expect {”
         puts -nonewline $es {”password:” }
         puts $es “{send “$password\n”}”
         puts $es {”Connection closed” return}
         puts $es “}”

         puts $es {expect “sftp>”}
         puts $es “send “cd $remoteFile\n””

         puts $es {expect “sftp>”}
         puts $es “send “ls \n””

         puts $es “expect {”
         puts -nonewline
         puts $es {-re “sftp > *.pdf”}
         puts $es “}”

         puts $es “set out $expect_out(buffer)”

         puts $es “foreach file [split $out \r\n] {”
         #puts $es ” send_user “DEBUG $file”n”
         puts $es “send “get $file /opt/quovadx/qdx5.7/integrator/cerner_cert/data/integrity/notes\n””
         puts $es “send “rm $file\n””
         puts $es “}”

         puts $es {expect “sftp>”}
         puts $es “send “bye\n””
         flush $es
         close $es

         set retVal [exec /opt/quovadx/qdx5.7/integrator/tcl/bin/expect $esn >>& /opt/quovadx/qdx5.7/integrator/temp/integrity_cn_sftp.out]

    Viewing 0 reply threads
    • Author
      Replies
      • #77747
        Charlie Bursell
        Participant

          You cannot run expect calls within the engine becausr, by definition, they block

          Write the expect script as an external script and exec it

      Viewing 0 reply threads
      • The forum ‘Tcl Library’ is closed to new topics and replies.