Here I am trying to run script from Server X and copy the logs from remote server ( Server Y) to local server ( Server X) home dir.
This is what I have tried. This copies the logs to server Y home dir.
user@X:/home ssh SERVER_Y "bash -s" < ./get_logs SystemOut*
Update: How do I reference the server X in get_logs while running on remote server ( without hardcoding server name in script)
Apologies for updating the question.
尝试这个:
scp /localdir/bla/myfile somehost:/home/karl
For download the whole directory from server to your current local directory
scp -r user@198.58.x.x:/var/log/ .
Here -r is used for recursively copy entire directories.
For single file downlod :
scp user@198.58.x.x:/var/log/some.log .
To upload log to your remote server :
scp some.log user@198.58.x.x:/var/log
Note : make sure you have read-write access to remote directory or file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.