Issue
I'm trying to run a few scripts remotely from a Ruby script and am at a loss with redirecting the output of the command to a file.
I'm sshing to another server, running a command with nohup
, and trying to write the output of the command to a file. The file gets written, but no content is in the file.
Here's an example of the command:
system("ssh server \"cd /tmp; nohup ./myscript.ksh 2>&1 >> output.txt &\"")
Any ideas? This should be working from what I understand.
Solution
@Arguardientico's solution worked:
system("ssh server \"cd /tmp; nohup ./myscript.ksh >> output.txt 2>&1 &\"")
Answered By - user797963 Answer Checked By - Clifford M. (WPSolving Volunteer)