#!/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)" ] && [ "$(ls -A $ASSETS)" != ".empty" ]; then # Then sync unison $ASSETS $DEST -auto -logfile /dev/null fi