Question

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.

Était-ce utile?

La solution

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/
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top