#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    6
    Rep Power
    0

    Monitoring a task


    Hi,
    I have 2 commands in a script:
    send "get fi.rpt\n"
    expect "sftp> "
    send "get fi_last_pickup\n"
    expect "sftp> "

    Most of the times, the script running ok. But once in a while, it only executes the first command. Here is the log file:
    sftp> get fi.rpt
    sftp> get fi_last_pickup
    Fetching /Home/fi.rpt to fi.rpt
    sftp>

    A suggestion is to add a sleep command in between the two commands for a few second. My question: Is there a way to continuing checking the first command until it successes then run the second command?
    Thank you.
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2006
    Posts
    858
    Rep Power
    388

    Cool


    Originally Posted by hyniem
    Hi,
    I have 2 commands in a script:
    send "get fi.rpt\n"
    expect "sftp> "
    send "get fi_last_pickup\n"
    expect "sftp> "

    Most of the times, the script running ok. But once in a while, it only executes the first command. Here is the log file:
    sftp> get fi.rpt
    sftp> get fi_last_pickup
    Fetching /Home/fi.rpt to fi.rpt
    sftp>

    A suggestion is to add a sleep command in between the two commands for a few second. My question: Is there a way to continuing checking the first command until it successes then run the second command?
    Thank you.
    Because you have 'expect "sftp> " ' after 'send "get fi.rpt\n" ', the script will WAIT before executing the next statement.

    There may be another reason why the script " only executes the first command. ".

  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    6
    Rep Power
    0
    Originally Posted by LKBrwn_DBA
    Because you have 'expect "sftp> " ' after 'send "get fi.rpt\n" ', the script will WAIT before executing the next statement.

    There may be another reason why the script " only executes the first command. ".

    Hi,
    That was what I thought. I agree that it might be another reason.
    Thank you for your answer.

IMN logo majestic logo threadwatch logo seochat tools logo