From 5a5fae904b6f01df0eadbc6e397827fc7d47c8af Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Thu, 5 Jan 2017 20:44:06 -0500 Subject: [PATCH] revised for more generality --- customize/fred/scripts/curies_musix_wand.sh | 46 --------------- customize/fred/scripts/musical_wand.sh | 64 +++++++++++++++++++++ 2 files changed, 64 insertions(+), 46 deletions(-) delete mode 100644 customize/fred/scripts/curies_musix_wand.sh create mode 100644 customize/fred/scripts/musical_wand.sh diff --git a/customize/fred/scripts/curies_musix_wand.sh b/customize/fred/scripts/curies_musix_wand.sh deleted file mode 100644 index 3a5fe7cc..00000000 --- a/customize/fred/scripts/curies_musix_wand.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# this script is meant to be run on curie with our super alpha prime source of music plugged in. - -source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" - -#hmmm: add the goodness around these like the nice updater. - -if [[ ! ( $(hostname) =~ .*curie.* ) ]]; then - echo this script is only designed to run on curie with the - echo fred music prime external disc plugged in. - exit 1 -fi - -# synch our local copy on curie with the music drive, source of all goodness. -function get_music_from_alpha_site() -{ - sep - echo "getting musix and basement from fred music prime device" - rsync -av /media/fred/fredmusicprime/musix/* /z/musix/ - rsync -av /media/fred/fredmusicprime/basement/* /z/basement/ - sep - echo -} - -# updates the music on a remote host to our current local copy on curie. -function update_musix_pile() -{ - sep - local host="$1"; shift - echo "$host: synching musix and basement" - rsync -avz /z/musix/* ${host}:/z/musix/ - rsync -avz /z/basement/* ${host}:/z/basement/ - sep - echo -} - -# make sure the local machine, curie, is in good shape. -get_music_from_alpha_site - -# run through the steps of updating all our machines. -for i in surya banshee wildmutt euphrosyne; do - update_musix_pile $i -done - - diff --git a/customize/fred/scripts/musical_wand.sh b/customize/fred/scripts/musical_wand.sh new file mode 100644 index 00000000..1251001c --- /dev/null +++ b/customize/fred/scripts/musical_wand.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +# musical_wand: distributes music from our primary source to all hosts that are listed +# as being redundant copies for the music. + +# this script is designed to be run on the music host with the super alpha main source of +# music plugged in as an external drive. that being said, it will still work as long as +# the music host has its local copy intact; the local copy of the primary is always what +# is synched onto the other archive hosts. in that sense, the musical host is itself a +# musix archive, but it is treated "special". + +source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" + +#hmmm: add the goodness around these actions like the "nice" updater so we catch all errors. + +# this host is where all the music is supposed to come from. +MUSICAL_HOST=curie + +#hmmm: this script is currently limited to run ON the music host. it could easily do the backwards thing instead, and copy FROM music host. + +# the list of hosts we know of that are holding onto duplicate copies of the musix archive. +MUSIX_ARCHIVE_SITE_LIST=(surya banshee wildmutt euphrosyne) + + +if [[ ! ( $(hostname) =~ .*${MUSICAL_HOST}.* ) ]]; then + echo "This script is only designed to run on $MUSICAL_HOST with the" + echo "primary fred music source (external) disc plugged in." + exit 1 +fi + +# synch our local copy on the music host with the primary music drive, source of all goodness. +function get_music_from_alpha_site() +{ + sep + echo "getting musix and basement from fred music prime device" + rsync -av /media/fred/fredmusicprime/musix/* /z/musix/ + rsync -av /media/fred/fredmusicprime/basement/* /z/basement/ + sep + echo +} + +# updates the music on a remote host to our current local copy on the music host. +function update_musix_pile() +{ + sep + local host="$1"; shift + echo "$host: synching musix and basement" + rsync -avz /z/musix/* ${host}:/z/musix/ + rsync -avz /z/basement/* ${host}:/z/basement/ + sep + echo +} + +############## + +# make sure the local machine, our first-stop musix host, is in good shape. +get_music_from_alpha_site + +# run through the steps of updating all our machines. +for i in ${MUSIX_ARCHIVE_SITE_LIST[@]}; do + update_musix_pile $i +done + + -- 2.34.1