redirect output to remote server via ssh
I need to output of the script to the remote server via redirect. I created a simple script for your reference.
Quote:
Quote:
Any recommendation. TIA |
A possible solution is create a temp file in your local system and then scp to remote host:
Quote:
Just a suggestion, its never a good idea to scp to another host as user root. Security consideration et all.... |
IO redirection works on files. If the file to which you redirect the stdout or stderr is mounted on the local filesystem, and if it is writable, then IO redirection will work as usual. To make the output file exist on a remote host, that remote host's filesystem must be exported by the remote host, and then mounted on the local filesystem. The two most likely candidates for performing this would be NFS or SMB/CIFS. There is no magic way to redirect output to an arbitrary remote filesystem. Libu's suggestion of creating the file on the local filesystem, and then transferring it to the remote host (which can be done in any number of ways), would be your other alternative.
--- rod. |
I am not sure I understand the question. I cannot tell if you want the output of the script to be redirected to a file on the remote host, or if you want the output of the script to be echoed as commands to be executed. Both are possible, but I assume you mean the former.
In this case, it is really a simple matter of using a pipe to redirect to ssh, followed by shell redirection on the remote machine. For example, Code:
echo "$(/usr/bin/w) As suggested above, ssh to root is a bad idea all around. |
Quote:
|
All times are GMT -5. The time now is 03:01 AM. |