#!/bin/bash
# /usr/local/bin/migrate_largest
# https://crystalfaeries.net/posix/bin/migrate_largest
# celeste:crystalfaery MIGRATE_LARGEST 2017-08-13 21:35:50+00:00
# migrate the largest ambient and meditative audio tracks to website
# our intent is to run this daily from crontab.
# NOTE: we preprocess incomplete rips by backdating them to 197001011000 so that
# we will always accumulate and preserve whole files over partials.
# NOTE: our monitor script will eventually force review of each file
# from largest to smallest, either, before or after, migration.
# ambient
largest="$(du -a /home/audio/streams/nirvana_ambient*/* | sort -n | cut -f2- | tail -n 1)"
rsync -auvzH ${largest} \
$(echo ${largest} | sed 's/\/home\/audio\/streams\/nirvana_ambient.*\//\/home\/crystalfaeries.net\/audio\/ambient\//g') \
>&/dev/null && rm "${largest}" || echo "ERROR: $? ambient"
# meditative
largest="$(du -a /home/audio/streams/nirvana_meditat*/* | sort -n | cut -f2- | tail -n 1)"
rsync -auvzH ${largest} \
$(echo ${largest} | sed 's/\/home\/audio\/streams\/nirvana_meditat.*\//\/home\/crystalfaeries.net\/audio\/meditative\//g') \
>&/dev/null && rm "${largest}" || echo "ERROR: $? meditative"
syntax highlighted by Code2HTML, v. 0.9.1