generated from me/template-mit
Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ef51915fb | ||
|
|
0a3b339921 | ||
|
|
9243bd5480 | ||
|
|
c09e5560e6 | ||
|
|
90a94ec648 | ||
|
|
945563aa28 | ||
|
|
bb542d1d2f | ||
|
|
7ff5431e83 | ||
|
|
0e193d430b | ||
|
|
bef7091063 | ||
|
|
890c991f18 | ||
|
|
f34e02c641 | ||
|
|
df8f7f3101 | ||
|
|
74fb1def7f | ||
|
|
6d0840d4eb | ||
|
|
eb9eb03c1e | ||
|
|
9d1141bf82 | ||
|
|
513c0d6fac | ||
|
|
6ed7475c02 | ||
|
|
6afd10b296 | ||
|
|
e815803630 |
No files matched your search
+26
-11
@@ -1,33 +1,48 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# TBD:
|
# TBD:
|
||||||
# - ensure all SERVER_* variables actually exist in environment
|
# - add parameter to set loop=true, and accept a value for sleep seconds
|
||||||
# - test the script :)
|
|
||||||
# - add parameter to set loop=true
|
|
||||||
# - allow passing the script a variable for the dir, rather than assuming curr
|
# - allow passing the script a variable for the dir, rather than assuming curr
|
||||||
|
|
||||||
## Variables ##
|
## Variables ##
|
||||||
|
|
||||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||||
loop=false
|
loop=false
|
||||||
|
|
||||||
|
DIR="`pwd`"
|
||||||
|
dir="`basename $DIR`"
|
||||||
|
|
||||||
## Validations ##
|
## Validations ##
|
||||||
|
|
||||||
if [[ "$DIR" != *"MASTER" ]]; then
|
if [[ "$DIR" != *"MASTER" ]]; then
|
||||||
echo "This directory is not labeled as a MASTER. Skipping upload."
|
echo "'$DIR' is not labeled as a MASTER. Skipping upload."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Main ##
|
## Main ##
|
||||||
|
|
||||||
new_dir="`basename $DIR`"
|
new_dir="${dir//MASTER/clone}"
|
||||||
new_dir="${new_dir//MASTER/clone}"
|
|
||||||
|
|
||||||
do
|
echo "`date` - Sending '$dir' to" \
|
||||||
clone -e "ssh -p $SERVER_PORT" ./ $SERVER_USER@$SERVER_NAME:$SERVER_SFTP/$new_dir
|
"'$PROD_DATA_USER@$PROD_DATA_HOST:$PROD_DATA_PORT$PROD_DATA_DIR/$new_dir'"
|
||||||
while $loop
|
|
||||||
|
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 ##
|
## Complete ##
|
||||||
|
|
||||||
echo "Done!"
|
echo "`date` - $PROG complete."
|
||||||
exit 0
|
exit 0
|
||||||
+41
-10
@@ -1,37 +1,61 @@
|
|||||||
# Notes:
|
# Notes:
|
||||||
# - Please keep this file working for both BASH and ZSH. :)
|
# - Please keep this file working for both BASH and ZSH. :)
|
||||||
|
|
||||||
echo "Shared RC Config - Loading..."
|
|
||||||
|
|
||||||
|
|
||||||
## Variables ##
|
## Variables ##
|
||||||
|
|
||||||
# Environment Usability
|
# Environment Usability
|
||||||
export PATH="$PATH:~/bin-shared:~/.bin-shared"
|
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 ##
|
## 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 ##
|
## Functions ##
|
||||||
|
|
||||||
# Related specifically to this project.
|
# Related specifically to this project.
|
||||||
|
|
||||||
function update-shared {
|
function update-shared {
|
||||||
|
log "`date` - Reloading the '~/.rc_shared' file from env-shared.\n"
|
||||||
branch="$1"
|
branch="$1"
|
||||||
if [[ -z "$branch" ]]; then
|
if [[ -z "$branch" ]]; then
|
||||||
branch="dev"
|
branch="dev"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git clone GIT_PROTOCOL://git@GIT_HOSTNAME:$GIT_PORT/env-shared \
|
dir="shared-rc-deleteme"
|
||||||
shared-deleteme --branch=$branch
|
|
||||||
|
|
||||||
mv -v ~/.rc_shared ~/.bin_shared ~/TRASH/
|
git clone https://git.hyperling.com/me/env-shared \
|
||||||
|
$dir --branch=$branch
|
||||||
|
|
||||||
mv -v shared-deleteme/rc_shared.sh ~/.rc_shared
|
mv -v $dir/rc_shared.sh ~/.rc_shared
|
||||||
mv -v shared-deleteme/bin_shared ~/.bin_shared
|
|
||||||
|
|
||||||
mv -v shared-deleteme ~/TRASH/shared-deleteme-`date "+%Y%m%d-%H%M%S"`
|
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 shared-update="update-shared"
|
||||||
alias reload-shared="update-shared"
|
alias reload-shared="update-shared"
|
||||||
@@ -42,6 +66,11 @@ alias shared-reload="update-shared"
|
|||||||
function send-master { send_master.sh; }
|
function send-master { send_master.sh; }
|
||||||
function goodbye { update -y; bye; }
|
function goodbye { update -y; bye; }
|
||||||
|
|
||||||
|
function clone {
|
||||||
|
rsync -auPhz --delete --exclude '.gradle' --exclude 'app/build' "$@"
|
||||||
|
}
|
||||||
|
export -f clone
|
||||||
|
|
||||||
# Enhance Bin Scripts
|
# Enhance Bin Scripts
|
||||||
|
|
||||||
function send-masters {
|
function send-masters {
|
||||||
@@ -52,6 +81,7 @@ function send-masters {
|
|||||||
cd ..
|
cd ..
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
export -f send-masters
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
|
|
||||||
@@ -60,4 +90,5 @@ function send-masters {
|
|||||||
|
|
||||||
## Complete! ##
|
## Complete! ##
|
||||||
|
|
||||||
echo "Shared RC Config - Complete!"
|
[[ $(whoami) != "root" ]] &&
|
||||||
|
echo "`date` - Shared RC Config - Complete!"
|
||||||
Reference in new issue
Block a user