Errant error output behavior with perl execute bash scripts on a remote machine

idleonbench

I have this line in my perl script that sshes into a remote machine and execute a bash script:

system("ssh -t remotemachine /dir/dir/bashscript");

In my bash script, I used exit code 2 some commands 2 >> error.txt to capture any errors that I may encounter and I want this error.txt to be written in the same folder where the bash script is stored.

My problem is when I ssh into the machine and run the program from the terminal, the error can be captured and written in error.txt but if I run the program from my perl, the program is able to run but the error is not captured.

Any suggestions?

tink

Use the full path for the capture file.

some commands 2 >> /dir/dir/error.txt

Otherwise the file will be created in the users $HOME if it exists.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to execute bash script on a remote machine asynchronously

From Dev

How to execute scripts in a parent-child behavior in bash?

From Dev

is it possible to execute a bash script on remote machine using python pexpect

From Dev

Execute exe on remote machine

From Dev

Execute readlink on a remote machine

From Dev

Execute readlink on a remote machine

From Dev

Parallel Python scripts on a remote machine

From Dev

Execute command inside a shell script on a remote machine and get output on local machine

From Dev

execute a program on a remote machine python

From Dev

Execute a command on Remote Machine in Python

From Dev

Execute Script available on remote machine

From Dev

Execute bash scripts on entering a directory

From Dev

exec on a remote machine and store output

From Dev

Source environment variables and execute bash before running local script on remote machine

From Dev

How to run programs and scripts NOT in the background on a remote machine?

From Dev

How to run scripts in parallel on a remote machine?

From Dev

Running QTP Scripts on a Remote Machine (Windows 7)

From Dev

Execute commands on a remote servers by 2 scripts

From Dev

Execute a remote bash script locally

From Dev

bash scripts with option flags inconsistent behavior

From Dev

Execute C# code on remote machine

From Dev

execute jar file from remote machine in java

From Dev

Execute command on docker container from remote machine

From Dev

How execute an AutoIt script on remote machine

From Dev

Execute code on remote machine and copy the results back

From Dev

Execute C# code on remote machine

From Dev

execute git command in a remote machine using paramiko

From Dev

How to execute a shell script stored on remote machine from a local machine?

From Dev

Got an error while executing bash commands on remote ubuntu machine "no tty present and no askpass program specified"

Related Related

  1. 1

    How to execute bash script on a remote machine asynchronously

  2. 2

    How to execute scripts in a parent-child behavior in bash?

  3. 3

    is it possible to execute a bash script on remote machine using python pexpect

  4. 4

    Execute exe on remote machine

  5. 5

    Execute readlink on a remote machine

  6. 6

    Execute readlink on a remote machine

  7. 7

    Parallel Python scripts on a remote machine

  8. 8

    Execute command inside a shell script on a remote machine and get output on local machine

  9. 9

    execute a program on a remote machine python

  10. 10

    Execute a command on Remote Machine in Python

  11. 11

    Execute Script available on remote machine

  12. 12

    Execute bash scripts on entering a directory

  13. 13

    exec on a remote machine and store output

  14. 14

    Source environment variables and execute bash before running local script on remote machine

  15. 15

    How to run programs and scripts NOT in the background on a remote machine?

  16. 16

    How to run scripts in parallel on a remote machine?

  17. 17

    Running QTP Scripts on a Remote Machine (Windows 7)

  18. 18

    Execute commands on a remote servers by 2 scripts

  19. 19

    Execute a remote bash script locally

  20. 20

    bash scripts with option flags inconsistent behavior

  21. 21

    Execute C# code on remote machine

  22. 22

    execute jar file from remote machine in java

  23. 23

    Execute command on docker container from remote machine

  24. 24

    How execute an AutoIt script on remote machine

  25. 25

    Execute code on remote machine and copy the results back

  26. 26

    Execute C# code on remote machine

  27. 27

    execute git command in a remote machine using paramiko

  28. 28

    How to execute a shell script stored on remote machine from a local machine?

  29. 29

    Got an error while executing bash commands on remote ubuntu machine "no tty present and no askpass program specified"

HotTag

Archive