generated from me/template-mit
Compare commits
36 Commits
main
...
4ef51915fb
| Author | SHA1 | Date | |
|---|---|---|---|
| 4ef51915fb | |||
| 0a3b339921 | |||
| 9243bd5480 | |||
| c09e5560e6 | |||
| 90a94ec648 | |||
| 945563aa28 | |||
| bb542d1d2f | |||
| 7ff5431e83 | |||
| 0e193d430b | |||
| bef7091063 | |||
| 890c991f18 | |||
| f34e02c641 | |||
| df8f7f3101 | |||
| 74fb1def7f | |||
| 6d0840d4eb | |||
| eb9eb03c1e | |||
| 9d1141bf82 | |||
| 513c0d6fac | |||
| 6ed7475c02 | |||
| 6afd10b296 | |||
| e815803630 | |||
| b94a3e4a0b | |||
| 9c9de6f96f | |||
| c5d1386211 | |||
| 9f6c7834d8 | |||
| bbf7bd5606 | |||
| 3f4d3363af | |||
| 8e3c581d16 | |||
| 3de906a03f | |||
| 1c919cb4d9 | |||
| 8bf6b5905c | |||
| 3c6a0994c6 | |||
| 9bb80b51c4 | |||
| 17a65f6ce0 | |||
| 353b38fad4 | |||
| c5a1015083 |
48
bin-shared/send_master.sh
Executable file
48
bin-shared/send_master.sh
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# TBD:
|
||||
# - add parameter to set loop=true, and accept a value for sleep seconds
|
||||
# - allow passing the script a variable for the dir, rather than assuming curr
|
||||
|
||||
## Variables ##
|
||||
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
loop=false
|
||||
|
||||
DIR="`pwd`"
|
||||
dir="`basename $DIR`"
|
||||
|
||||
## Validations ##
|
||||
|
||||
if [[ "$DIR" != *"MASTER" ]]; then
|
||||
echo "'$DIR' is not labeled as a MASTER. Skipping upload."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
## Main ##
|
||||
|
||||
new_dir="${dir//MASTER/clone}"
|
||||
|
||||
echo "`date` - Sending '$dir' to" \
|
||||
"'$PROD_DATA_USER@$PROD_DATA_HOST:$PROD_DATA_PORT$PROD_DATA_DIR/$new_dir'"
|
||||
|
||||
sleep=0
|
||||
while true; do
|
||||
if (( $sleep > 0 )); then
|
||||
echo "Sleeping for '$sleep' seconds..."
|
||||
sleep $sleep
|
||||
fi
|
||||
clone -e "ssh -p $PROD_DATA_PORT" ./ \
|
||||
$PROD_DATA_USER@$PROD_DATA_HOST:$PROD_DATA_DIR/$new_dir &&
|
||||
echo "`date` - Success!" ||
|
||||
echo "`date` - Failed!"
|
||||
sleep=30
|
||||
if [[ "$loop" == false ]]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
## Complete ##
|
||||
|
||||
echo "`date` - $PROG complete."
|
||||
exit 0
|
||||
94
rc_shared.sh
Normal file
94
rc_shared.sh
Normal file
@@ -0,0 +1,94 @@
|
||||
# Notes:
|
||||
# - Please keep this file working for both BASH and ZSH. :)
|
||||
|
||||
## Variables ##
|
||||
|
||||
# Environment Usability
|
||||
export PATH="$PATH:~/bin-shared:~/.bin-shared"
|
||||
|
||||
# PS1 Colors
|
||||
export PURPLE="`tput setaf 55`"
|
||||
export ORANGE="`tput setaf 208`"
|
||||
export GREEN="`tput setaf 34`"
|
||||
|
||||
export RED="`tput setaf 196`"
|
||||
export SCARLET="`tput setaf 160`"
|
||||
export YELLOW="`tput setaf 226`"
|
||||
|
||||
export GRAY="`tput setaf 243`"
|
||||
|
||||
export RESET="`tput sgr0`"
|
||||
export BOLD="`tput bold`"
|
||||
|
||||
|
||||
## Aliases ##
|
||||
|
||||
# Quickies
|
||||
alias reload-bash="source ~/.bashrc"
|
||||
alias bash-reload="reload-bash"
|
||||
alias shell-reload="reload-bash"
|
||||
alias reload-shell="reload-bash"
|
||||
alias reload="reload-bash"
|
||||
|
||||
alias l='ls '
|
||||
alias ll='ls -alh '
|
||||
alias lh='ls -ash '
|
||||
|
||||
|
||||
## Functions ##
|
||||
|
||||
# Related specifically to this project.
|
||||
|
||||
function update-shared {
|
||||
log "`date` - Reloading the '~/.rc_shared' file from env-shared.\n"
|
||||
branch="$1"
|
||||
if [[ -z "$branch" ]]; then
|
||||
branch="dev"
|
||||
fi
|
||||
|
||||
dir="shared-rc-deleteme"
|
||||
|
||||
git clone https://git.hyperling.com/me/env-shared \
|
||||
$dir --branch=$branch
|
||||
|
||||
mv -v $dir/rc_shared.sh ~/.rc_shared
|
||||
|
||||
mv -v $dir ~/TRASH/"$dir-`date "+%Y%m%d-%H%M%S"`"
|
||||
|
||||
log "\n`date` - Complete! Please note this does NOT update bin files."
|
||||
}
|
||||
alias shared-update="update-shared"
|
||||
alias reload-shared="update-shared"
|
||||
alias shared-reload="update-shared"
|
||||
|
||||
# Shortcuts
|
||||
|
||||
function send-master { send_master.sh; }
|
||||
function goodbye { update -y; bye; }
|
||||
|
||||
function clone {
|
||||
rsync -auPhz --delete --exclude '.gradle' --exclude 'app/build' "$@"
|
||||
}
|
||||
export -f clone
|
||||
|
||||
# Enhance Bin Scripts
|
||||
|
||||
function send-masters {
|
||||
ls | grep MASTER | while read dir; do
|
||||
echo "Preparing to sync '$dir' to '$SERVER_NAME'."
|
||||
cd $dir
|
||||
send-master
|
||||
cd ..
|
||||
done
|
||||
}
|
||||
export -f send-masters
|
||||
|
||||
# Audio
|
||||
|
||||
# Video
|
||||
|
||||
|
||||
## Complete! ##
|
||||
|
||||
[[ $(whoami) != "root" ]] &&
|
||||
echo "`date` - Shared RC Config - Complete!"
|
||||
Reference in New Issue
Block a user