Team, am executing some commands on remote ubuntu server from ubuntu client. I want to save output of that to a local client directory.
Am trying to run other commands from client after I save the result of command that i ran over ssh session.
Steps: Connect to Remote ssh over proxycommand, Then start a process, then save its state in a file. I want this file to be saved locally and not remotely. Secondly, when i execute command manually on remote machine, i see the status is saved in file but when doing via script the file is still empty. any hint?
ssh -o StrictHostKeyChecking=no -i test-ssh-key -o 'ProxyCommand ssh -i test-ssh-key -W %h:%p [email protected]' lab@$free_node "echo Test!!123 | sudo -S echo; sudo systemctl start cachefilesd; sudo rm /var/log/cachefiles_status.log; sudo ps x | grep cachefilesd | sudo awk '{print $1}' | sudo sed -n -e 1,1p | xargs -l1 -- sh -c 'sudo grep "State:" /proc/$1/status' -- | awk -F '(' '{print $2}' | awk -F ')' '{print $1}' > /tmp/cachefiles_status.log; sudo cp /tmp/cachefiles_status.log /var/log/; sudo cat /var/log/cachefiles_status.log; ls -ltr /var/log"