Skip to content

Instantly share code, notes, and snippets.

@ylgrgyq
Created May 15, 2020 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ylgrgyq/0d5ae27c37c9115ec0b29d87fe5dfd52 to your computer and use it in GitHub Desktop.
Save ylgrgyq/0d5ae27c37c9115ec0b29d87fe5dfd52 to your computer and use it in GitHub Desktop.
#!/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