bitreich-drist

fork of bitreich.org/drist
git clone git://git.pyratebeard.net/bitreich-drist.git
Log | Files | Refs | README | LICENSE

commit b41d37d283f4e4d5bd18a4d37cf86cdfcb1e5759
Author: Solene Rapenne <solene@perso.pw>
Date:   Tue, 17 Jul 2018 11:58:33 +0200

file copy ok

Diffstat:
Adrist | 39+++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+), 0 deletions(-)

diff --git a/drist b/drist @@ -0,0 +1,39 @@ +#!/bin/sh +set -x + +if [ -z "$1" ] +then + echo "il faut indiquer un serveur" + exit 1 +else + HOSTNAME=$(ssh "$1" hostname -s) + if [ "$?" -ne 0 ] + then + echo "Error while ssh ${1}" + exit 2 + fi +fi + +# -l = keep symlink / -D = special device +if [ -d "files" ] +then + LIST=$(mktemp /tmp/drist-rsync.XXXXXXXXXX) + if [ -f "$LIST" ] + then + find files/ -type f | cut -d '/' -f 2- > "${LIST}" + cat $LIST + rsync -vlD --files-from="${LIST}" files/ ${1}:/ + rm "$LIST" + fi +fi + +if [ -d "files-${HOSTNAME}" ] +then + LIST=$(mktemp /tmp/drist-rsync.XXXXXXXXXX) + if [ -f "$LIST" ] + then + find "files-${HOSTNAME}/" -type f | cut -d '/' -f 2- > "${LIST}" + rsync -vlD --files-from="${LIST}" "files-${HOSTNAME}/" ${1}:/ + rm "$LIST" + fi +fi