Reputation: 338
I have two machines:
In my C++ Code on A I want to be able to run and stop different docker compose files on B. I dont need the print of these Containers on A and I also dont want them to block my command on A.
So a naive approach could be:
std::string ssh_command = "ssh [email protected] 'docker compose -f /home/user/analysis.yml up system'";
int result = std::system(ssh_command.c_str());
if (result != 0) {
std::cerr << "Error executing SSH command: " << ssh_command << std::endl;
}
But with this way I will receive alle the print in my terminal in A and also my code will not continue. What is an elegant way to do that? Since in the future I might launch also different stuff than dockers, I prefere using ssh.
Upvotes: 0
Views: 50