Reputation: 303
I need to know how to direct the output from a function in Fabric to a file on a remote host.
I have a host that I run my fab commands from, let's call it mainhost. I have a host, testhost, and I run a "date" command via fab on this host to get testhost's date. I want to print this date command output into a date.txt on testhost.
So the fabfile sits on mainhost, connects to testhost and asks for its date, and I want testhost's date to print to a file which is one testhost. Is this possible?
Thanks
Upvotes: 1
Views: 968
Reputation: 11
Yes, it's possible.
You can simply run the below command:
run("date > date.txt")
This will run the command date and redirect it to date.txt.
Upvotes: 1