summaryrefslogtreecommitdiff
path: root/herculeswrapper
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-10 02:36:57 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-10 02:36:57 +0300
commit0b974c74a13a9e493ed4f3c2da3569ddaaa45c74 (patch)
tree993d09576f0ea7bc4d59025c9417597c9ec1be02 /herculeswrapper
parent5c0fc1fc767b7b447d787d8123b23e99a35b8577 (diff)
downloadevol-tools-0b974c74a13a9e493ed4f3c2da3569ddaaa45c74.tar.gz
evol-tools-0b974c74a13a9e493ed4f3c2da3569ddaaa45c74.tar.bz2
evol-tools-0b974c74a13a9e493ed4f3c2da3569ddaaa45c74.tar.xz
evol-tools-0b974c74a13a9e493ed4f3c2da3569ddaaa45c74.zip
herculeswrapper: add support for git pull + git stash
Diffstat (limited to 'herculeswrapper')
-rw-r--r--herculeswrapper/include.sh43
-rwxr-xr-xherculeswrapper/map.sh7
2 files changed, 50 insertions, 0 deletions
diff --git a/herculeswrapper/include.sh b/herculeswrapper/include.sh
index fe0c276..76f49aa 100644
--- a/herculeswrapper/include.sh
+++ b/herculeswrapper/include.sh
@@ -40,3 +40,46 @@ function server_logic {
fi
done
}
+
+function stash_save {
+ STR=$(git diff --stat --color=always)
+ if [[ -n "${STR}" ]]; then
+ echo ${1}: git stash save "wrapper pull"
+ git stash save "wrapper pull"
+ export ${1}_saved="1"
+ else
+ export ${1}_saved="0"
+ fi
+}
+
+function stash_pop {
+ var="${1}_saved"
+ eval var=\$$var
+ if [[ "${var}" == "1" ]]; then
+ echo ${1}: git stash pop
+ git stash pop
+ fi
+}
+
+function pull_all {
+ stash_save "data"
+ cd ../server-code
+ stash_save "code"
+ cd src/evol
+ stash_save "plugin"
+ cd ../../../tools
+ stash_save "tools"
+ cd ..
+ ./pull.sh
+ cd server-data
+ stash_pop "data"
+ cd ../server-code
+ stash_pop "code"
+ cd src/evol
+ stash_pop "plugin"
+ cd ../../../tools
+ stash_pop "tools"
+ cd ..
+ ./status.sh
+ cd server-data
+}
diff --git a/herculeswrapper/map.sh b/herculeswrapper/map.sh
index ed2a1bd..bbbf65a 100755
--- a/herculeswrapper/map.sh
+++ b/herculeswrapper/map.sh
@@ -34,5 +34,12 @@ while [ 1 ] ; do
103)
echo "Restarting map server..."
;;
+ 104)
+ echo "git pull..."
+ pull_all
+ echo "Restarting all servers..."
+ send_all_pipes "restart"
+ sleep 5s
+ ;;
esac
done