Reputation: 9
I perform ssh to remote server to run a backup script. Then scp it to local machine.
1. ssh root@Remoteserverip sh ~/folder/backupscript.sh
2. scp root@Remoteserverip:/backupfolder/file.tgz /localfolder/
Is there any way to script these two operations in one script?
Ps: couldn't find solution elsewhere.
Upvotes: 0
Views: 518
Reputation: 59575
Why not? Just put those commands in the script and thats it.
ssh root@Remoteserverip sh ~/folder/backupscript.sh
scp root@Remoteserverip:/backupfolder/file.tgz /localfolder/
Upvotes: 1