generated from me/template-mit
Compare commits
15 Commits
ef097e973e
...
stage
| Author | SHA1 | Date | |
|---|---|---|---|
| 391b0a0b09 | |||
| a76cb8b5ec | |||
| a87c205a80 | |||
| 186519fb0e | |||
| 7fa1430b34 | |||
| 074f0a29bf | |||
| bdb06cd0b4 | |||
| ec9b74d3d8 | |||
| 0bfdc8d411 | |||
| 89c0d0589c | |||
| 3edd062852 | |||
| bc81d1bedd | |||
| c859b4dcd8 | |||
| be0469fb94 | |||
| 5351df572b |
@@ -13,8 +13,8 @@ dir="`basename $DIR`"
|
||||
|
||||
## Validations ##
|
||||
|
||||
if [[ "$DIR" != *"-clone" ]]; then
|
||||
echo "'$DIR' is not labeled as a clone. Skipping download."
|
||||
if [[ "$DIR" != *"-clone" && "$DIR" != *"-SYNC" ]]; then
|
||||
echo "'$DIR' is not labeled as a CLONE or SYNC. Skipping download."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
@@ -39,6 +39,7 @@ while true; do
|
||||
|
||||
if [[ "$subdirs_only" == "true" ]]; then
|
||||
ls $DIR | while read subdir; do
|
||||
echo -e "\n`date` - Working subdirectory '$subdir'..."
|
||||
clone -e "ssh -p $PROD_DATA_PORT" \
|
||||
$PROD_DATA_USER@$PROD_DATA_HOST:$PROD_DATA_DIR/$dir/$subdir/ \
|
||||
./$subdir &&
|
||||
@@ -61,5 +62,5 @@ done
|
||||
|
||||
## Complete ##
|
||||
|
||||
echo "`date` - $PROG complete."
|
||||
echo -e "\n`date` - $PROG complete."
|
||||
exit 0
|
||||
|
||||
@@ -14,8 +14,8 @@ dir="`basename $DIR`"
|
||||
|
||||
## Validations ##
|
||||
|
||||
if [[ "$DIR" != *"-MASTER" ]]; then
|
||||
echo "'$DIR' is not labeled as a MASTER. Skipping upload."
|
||||
if [[ "$DIR" != *"-MASTER" && "$DIR" != *"-SYNC" ]]; then
|
||||
echo "'$DIR' is not labeled as a MASTER or SYNC. Skipping upload."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
120
rc_shared.sh
120
rc_shared.sh
@@ -60,6 +60,21 @@ function update-shared {
|
||||
|
||||
mv -v $dir/rc_shared.sh ~/.rc_shared
|
||||
|
||||
local_bin="$HOME/bin"
|
||||
remote_bin="shared-rc-deleteme/bin-shared"
|
||||
if [[ -d "$local_bin" ]]; then
|
||||
log "\n`date` - Found '$local_bin', adding scripts.\n"
|
||||
mv -v $remote_bin/*.sh "$local_bin"/
|
||||
|
||||
refactor_script="refactor_music_library.sh"
|
||||
wget -O "$refactor_script" \
|
||||
https://git.hyperling.com/me/shell-music-refactor-library/src/branch/main/refactor_music_library.sh
|
||||
mv -v $refactor_script "$local_bin"/
|
||||
else
|
||||
echo "Did not find '$local_bin', did not copy scripts."
|
||||
fi
|
||||
|
||||
log "\n`date` - Done! Removing git clone.\n"
|
||||
mv -v $dir ~/TRASH/"$dir-`date "+%Y%m%d-%H%M%S"`"
|
||||
|
||||
log "\n`date` - Complete! Please note this does NOT update bin files."
|
||||
@@ -71,7 +86,24 @@ alias shared-reload="update-shared"
|
||||
# Shortcuts #
|
||||
|
||||
function send-master { send_master.sh; }
|
||||
alias push-master="send-master"
|
||||
alias sync-master="send-master"
|
||||
|
||||
function pull-clone { pull_clone.sh; }
|
||||
alias get-clone="pull-clone"
|
||||
alias sync-clone="pull-clone"
|
||||
|
||||
alias send-sync="send-master"
|
||||
alias push-sync="send-master"
|
||||
alias pull-sync="pull-clone"
|
||||
alias get-sync="pull-clone"
|
||||
function sync-sync {
|
||||
cat <<- EOF
|
||||
Command not implemented, too dangerous guessing the state of the folder.
|
||||
|
||||
Please use push-sync and pull-sync in the correct order for its current state.
|
||||
EOF
|
||||
}
|
||||
|
||||
function goodbye { update -y; bye; }
|
||||
|
||||
@@ -82,11 +114,32 @@ function clone {
|
||||
function now { date "+%Y%m%d-%H%M%S"; }
|
||||
function today { date "+%Y%m%d"; }
|
||||
|
||||
function log { echo -e "$1"; }
|
||||
function blog { echo -e "\n\n$1\n\n"; }
|
||||
|
||||
function pull {
|
||||
if [[ -d .git ]]; then
|
||||
git pull --recurse-submodules
|
||||
else
|
||||
pull-clone
|
||||
fi
|
||||
}
|
||||
|
||||
function push {
|
||||
if [[ -d .git ]]; then
|
||||
git push && load-stage && load-prod
|
||||
else
|
||||
send-master
|
||||
fi
|
||||
}
|
||||
|
||||
# Enhance Bin Scripts #
|
||||
|
||||
# MASTER and CLONE folders.
|
||||
|
||||
function send-masters {
|
||||
echo -e "`date` - Looping through MASTER directories."
|
||||
ls | grep '\-MASTER' | while read dir; do
|
||||
ls | grep "\-MASTER" | while read dir; do
|
||||
echo -e "\n`date` - Found '$dir'..."
|
||||
cd $dir
|
||||
send-master
|
||||
@@ -94,17 +147,76 @@ function send-masters {
|
||||
done
|
||||
echo -e "\n`date` - Done checking for MASTER directories."
|
||||
}
|
||||
alias push-masters="send-masters"
|
||||
alias sync-masters="send-masters"
|
||||
|
||||
function pull-clones {
|
||||
echo -e "`date` - Looping through clone directories.\n"
|
||||
ls | grep '\-clone' | while read dir; do
|
||||
echo -e "`date` - Found '$dir'..."
|
||||
echo -e "`date` - Looping through clone directories."
|
||||
ls | grep "\-clone" | while read dir; do
|
||||
echo -e "\n`date` - Found '$dir'..."
|
||||
cd $dir
|
||||
pull-clone
|
||||
cd ..
|
||||
done
|
||||
echo -e "\n`date` - Done checking for clone directories."
|
||||
}
|
||||
alias get-clones="pull-clones"
|
||||
alias sync-clones="pull-clones"
|
||||
|
||||
function sync-all {
|
||||
push-masters
|
||||
echo -e "\n"
|
||||
pull-clones
|
||||
|
||||
echo -e "\n`date` - Skipping SYNC folders! Please do their loads separately."
|
||||
ls | grep "\-SYNC" | while read dir; do
|
||||
echo "- $dir"
|
||||
done
|
||||
|
||||
echo -e "`date` - \nDone."
|
||||
}
|
||||
function sync-all-loop {
|
||||
while true; do
|
||||
sync-all
|
||||
echo -e "\n\n*** Sleeping... ***\n\n"
|
||||
sleep 30
|
||||
done
|
||||
}
|
||||
|
||||
# SYNC folders.
|
||||
|
||||
function send-syncs {
|
||||
echo -e "`date` - Looping through SYNC directories."
|
||||
ls | grep "\-SYNC" | while read dir; do
|
||||
echo -e "\n`date` - Found '$dir'..."
|
||||
cd $dir
|
||||
send-master
|
||||
cd ..
|
||||
done
|
||||
echo -e "\n`date` - Done checking for SYNC directories."
|
||||
}
|
||||
alias push-syncs="send-syncs"
|
||||
|
||||
function pull-syncs {
|
||||
echo -e "`date` - Looping through SYNC directories."
|
||||
ls | grep "\-SYNC" | while read dir; do
|
||||
echo -e "\n`date` - Found '$dir'..."
|
||||
cd $dir
|
||||
pull-clone
|
||||
cd ..
|
||||
done
|
||||
echo -e "\n`date` - Done checking for SYNC directories."
|
||||
}
|
||||
alias get-syncs="pull-syncs"
|
||||
|
||||
function sync-syncs {
|
||||
cat <<- EOF
|
||||
Command not implemented, too dangerous guessing the state of the folder.
|
||||
|
||||
Please use push-syncs and pull-syncs in the correct order for its current state.
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
# Audio #
|
||||
|
||||
|
||||
Reference in New Issue
Block a user