Vysh
Vysh

Reputation: 45

Plink is not returning to command prompt when executing start_http

I'm executing a command using Plink through a Perl file from a Windows machine.

system("cmd /c c:\\plink.exe -batch -ssh -l $user_name @ $host_name  -pw  $pwd start_http");

Execution is hanging. When I execute the same command from command prompt, Plink is not returning to command prompt.

Tried using & at the end of the command but no use. And I don't want to redirect output to any log file.

Whereas "stop" command is working fine

system("cmd /c c:\\plink.exe -batch -ssh -l $user_name @ $host_name  -pw  $pwd stop_http");

Upvotes: 1

Views: 1939

Answers (1)

arunkumarreddy
arunkumarreddy

Reputation: 177

stdout/err must be detached from the terminal.

So change command to

system("cmd /c c:\\plink.exe -batch -ssh -l $user_name @ $host_name  -pw  $pwd start_http /dev/null 2>&1 &");

Upvotes: 1

Related Questions