Add basic ssh host backup script
This commit is contained in:
12
.bin/save-ssh-host
Executable file
12
.bin/save-ssh-host
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
selected_hosts="$(ssh-hosts | fzf -m)"
|
||||||
|
|
||||||
|
for host in $selected_hosts; do
|
||||||
|
echo "Saving $host"
|
||||||
|
directories="$(ssh "$host" ls | fzf -m)"
|
||||||
|
for directory in $directories; do
|
||||||
|
echo "Saving $host:$directory"
|
||||||
|
ssh "$host" "(tar cvzf - ~/$directory)" > "${host}_${directory}.tar.gz"
|
||||||
|
done
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user