#!/bin/bash DATA_DEVICE_UUID="C6CE6C2BCE6C1649" #DATA_DEVICE_UUID="ba2edfb9-01" MOUNT_PATH="/mnt/extern" DATA="${MOUNT_PATH}/timelapse" CLIENT="timelapse@192.168.111.2" CLIENT_FOLDER="/timelapse" mountpoint -q ${MOUNT_PATH} if [ ${?} != 0 ] then sudo mount --uuid ${DATA_DEVICE_UUID} -o uid=1000,gid=1000,umask=0022 ${MOUNT_PATH} || echo "Cannot mount data device with UUID ${DATA_DEVICE_UUID}!"; exit 1 fi if [ ! -e "${DATA}" ] then mkdir -p ${DATA} fi if [ ! -e "${DATA}/in" ] then mkdir -p "${DATA}/in" fi rsync -q -a --remove-source-files "${CLIENT}:${CLIENT_FOLDER}/*.jpg" "${DATA}/in" if [ ! -e "${DATA}/data" ] then mkdir -p "${DATA}/data" fi for i in `find "${DATA}/in/" -name "*.jpg" -type f` do if [ `stat -c%s ${i} ` -gt 0 ] then #convert -quiet ${i} -resize 1080 "${DATA}/data/`basename ${i}`" daystring=`basename ${i} | cut -d"_" -f1 | sed 's/\([0-9]\{4\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)-\([0-9]\{2\}\)\([0-9]\{2\}\)\([0-9]\{2\}\)/\3\.\2\.\1 \4:\5/'` convert -quiet ${i} -resize 1080 -gravity SouthEast -pointsize 22 -fill white -annotate +30+30 "${daystring}" "${DATA}/data/`basename ${i}`" fi rm "${i}" done