To run perl file on remote system through eggplant script

Help me regarding the following issue:

I want to invoke and execute a perl script on remote system through the eggplant script. The perl script should execute and depending on its returning value, i want to proceed through the eggplant script.

Also provide me with the sample script for the same.

Comments

  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    There are a couple of ways to go about this. The first would be to take the standard Eggplant approach of answering the question "How would a person do this on the SUT?". Using this approach here would work (write a script to open a shell or terminal application on the SUT; type the command to run your perl script; select the output and copy it to the clipboard, etc ...) but is probably not quite the answer you are looking for.

    The other approach would be to use SenseTalk's shell() function. The shell() function will execute a command on the local (Eggplant) machine. To use it to execute a command on the SUT, you'll need to use ssh. The Eggplant script to do this would look something like this:
    put shell("ssh sutmachine /path/to/remote/perlscript") into scriptOutput
    put the result into returnValue
    
    The ssh command that is passed to the shell function will be executed on the local machine, causing it to connect to the sutmachine and run the perlscript there. In the example above, the output of the perlscript will be put into the scriptOutput variable. The next line stores the result of the call (the value returned by the perlscript) into the returnValue variable. This needs to be done on the very next line after the shell() call. You can then use the values of these two variables in any way you want within your script.

    The ssh command will work as shown above if you configure ssh on your machine to use RSA based public key authentication. Otherwise it gets more complicated as it will ask for a password when it is run. Read the ssh man page for more details. You may also be able to do something similar using telnet rather than ssh, if it is available on your SUT.
Sign In or Register to comment.