From 26cd512aa7b8f5f9d7cbeaa4c7fd34641c030301 Mon Sep 17 00:00:00 2001 From: Cache do Fluxo Date: Tue, 8 Nov 2016 18:16:10 -0200 Subject: Adds custom synchronizer --- .sync-media/custom | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 .sync-media/custom diff --git a/.sync-media/custom b/.sync-media/custom new file mode 100755 index 0000000..0ae38d2 --- /dev/null +++ b/.sync-media/custom @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Custom syncronizer for hydractl sync-media. +# + +# Parameters +BASENAME="`basename $0`" +DIRNAME="`dirname $0`" +BASE="`cd $DIRNAME/.. && pwd`" +DEST="$1/data" +ASSETS="$BASE/data" + +# Syntax +if [ "$DEST" == "/data" ]; then + echo "usage: $BASENAME " + exit 1 +elif [ ! -d "$DEST" ]; then + echo "folder $DEST does not exist." + exit 1 +fi + +# Check if there are assets +if [ ! -z "$(ls -A $ASSETS)" ]; then + # Then sync + unison $ASSETS $DEST -auto -logfile /dev/null +fi -- cgit v1.2.3