Compare commits

...
21 Commits
Author SHA1 Message Date
me 4ef51915fb Update TBD's. 2026-03-28 14:03:52 -07:00
me 0a3b339921 Finalize changes needed to get send-master to work!! Yay! 2026-03-28 14:03:08 -07:00
me 9243bd5480 Add exporting of functions needed for scripts. 2026-03-28 13:44:40 -07:00
me c09e5560e6 Change clone to use all-params ($@). 2026-03-28 13:37:50 -07:00
me 90a94ec648 Move clone and ls aliases to shared. 2026-03-28 13:34:38 -07:00
me 945563aa28 Change double quotes to singles in clone command. 2026-03-28 13:30:44 -07:00
me bb542d1d2f Further fix the while loop. 2026-03-28 13:29:34 -07:00
me 7ff5431e83 Change do-while to while. 2026-03-28 13:27:01 -07:00
me 0e193d430b Fix misquotes. 2026-03-28 12:54:19 -07:00
me bef7091063 Fix output for updater. 2026-03-28 12:25:04 -07:00
me 890c991f18 Use log rather than echo. Add quotes on color assignments. 2026-03-28 12:22:41 -07:00
me f34e02c641 Ensure colors are exported! 2026-03-28 12:20:14 -07:00
me df8f7f3101 Add output to rc shared updater. 2026-03-28 12:19:25 -07:00
me 74fb1def7f Fix the function to reload shared RC file. 2026-03-28 12:18:24 -07:00
me 6d0840d4eb Fix the DIR variable to be current directory, not program directory. 2026-03-28 12:15:17 -07:00
me eb9eb03c1e Remove start message. 2026-03-28 12:10:57 -07:00
me 9d1141bf82 Fix output to be more helpful. 2026-03-28 12:08:29 -07:00
me 513c0d6fac Add colors for PS1 prompts. 2026-03-28 12:08:16 -07:00
me 6ed7475c02 Change command to use the proper variables which should now exist in each main env project. Add a sleep for the loop with conditional output. 2026-03-27 18:40:11 -07:00
me 6afd10b296 Only show the output if not running as root. 2026-03-27 18:35:26 -07:00
me e815803630 Add dates to output. 2026-03-27 18:34:20 -07:00
2 changed files with 67 additions and 21 deletions

No files matched your search

+26 -11
View File
@@ -1,33 +1,48 @@
#!/usr/bin/env bash
# TBD:
# - ensure all SERVER_* variables actually exist in environment
# - test the script :)
# - add parameter to set loop=true
# - 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 ##
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
PROG="$(basename -- "${BASH_SOURCE[0]}")"
loop=false
DIR="`pwd`"
dir="`basename $DIR`"
## Validations ##
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
fi
## Main ##
new_dir="`basename $DIR`"
new_dir="${new_dir//MASTER/clone}"
new_dir="${dir//MASTER/clone}"
do
clone -e "ssh -p $SERVER_PORT" ./ $SERVER_USER@$SERVER_NAME:$SERVER_SFTP/$new_dir
while $loop
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 "Done!"
echo "`date` - $PROG complete."
exit 0
+41 -10
View File
@@ -1,37 +1,61 @@
# Notes:
# - Please keep this file working for both BASH and ZSH. :)
echo "Shared RC Config - Loading..."
## 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
git clone GIT_PROTOCOL://git@GIT_HOSTNAME:$GIT_PORT/env-shared \
shared-deleteme --branch=$branch
dir="shared-rc-deleteme"
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 shared-deleteme/bin_shared ~/.bin_shared
mv -v $dir/rc_shared.sh ~/.rc_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 reload-shared="update-shared"
@@ -42,6 +66,11 @@ alias shared-reload="update-shared"
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 {
@@ -52,6 +81,7 @@ function send-masters {
cd ..
done
}
export -f send-masters
# Audio
@@ -60,4 +90,5 @@ function send-masters {
## Complete! ##
echo "Shared RC Config - Complete!"
[[ $(whoami) != "root" ]] &&
echo "`date` - Shared RC Config - Complete!"