summaryrefslogtreecommitdiff
path: root/herculeswrapper
diff options
context:
space:
mode:
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