Created
May 15, 2020 03:42
-
-
Save ylgrgyq/0d5ae27c37c9115ec0b29d87fe5dfd52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
patch=$1 | |
is_real=false | |
function show_helper | |
{ | |
echo "usage: hot-patch.sh patch-file-path [real] servers" | |
echo "eg: hot-patch.sh some-patch.clj real rtm51:11111 rtm52:11111 rtm53:11111" | |
echo "note: without the \"real\" option, only the first server in servers list will be patched" | |
} | |
if [ $# -lt 2 ]; then | |
show_helper | |
exit | |
fi | |
if [ ! -f "$patch" ]; then | |
echo -e "$patch does not exists!\n" | |
show_helper | |
exit | |
fi | |
shift | |
while [ "$1" != "" ]; do | |
case $1 in | |
real ) is_real=true | |
;; | |
* ) echo "Start patch on $1 ..." | |
cat $patch | lein repl :connect $1 | |
echo "$1 is patched" | |
if [ "$is_real" != true ]; then | |
exit | |
fi | |
esac | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment