Results 1 to 2 of 2

Thread: in Expect Script how to handle expect script to wait for & execute another script?

  1. #1
    Join Date
    May 2013
    Beans
    1

    in Expect Script how to handle expect script to wait for & execute another script?

    Using Expect script I am trying to automate execution of 2 different scripts run by 2 different users on same server.
    Script 1 needs to be run by user 1
    Script 2 needs to be run by user 2.

    The workflow of these scripts is:
    Script 1 is executed as user 1. During execution it creates Script 2 and halts for input. At this stage it asks to execute script2 as user 2 and once complete. Script 1 will resume when return key is pressed.

    The problem I am facing is when Script 1 halts and waits for input i don't know how to execute script2 as user2 and then resume script 1.

    I really need some help on this. I am very new to scripting.

  2. #2
    Join Date
    Aug 2011
    Location
    47°9′S 126°43W
    Beans
    2,172
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: in Expect Script how to handle expect script to wait for & execute another script

    If you script uses the 'sudo' command to execute script2 it just needs to wait until the sudo command terminates (in other words, the instruction after the sudo will be executed after script2 exits).

    This may require a bit of setup of sudoers.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •