mirror of
https://github.com/kaboomserver/buildpack.git
synced 2024-09-28 19:23:01 +00:00
Move scripts to separate files to avoid tmux issues
This commit is contained in:
parent
75d995d658
commit
05c31c8876
12
bin/alivecheck
Executable file
12
bin/alivecheck
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
#!/bin/sh
|
||||||
|
while true; do
|
||||||
|
sleep 12
|
||||||
|
date="$(tail -1 $HOME/logs/latest.log | grep -oP '(?<=\[).*?(?=\])' | head -1 | date -f - +%s)"
|
||||||
|
if [ "$(env printf '\xFE' | nc -w 5 localhost 25565 | wc -m)" -eq 1 ] ||
|
||||||
|
[ "$(( $(date +%s) - "${date:=$(date +%s)}" ))" -gt 180 ]; then
|
||||||
|
if [ "$(tail -20 $HOME/logs/latest.log | grep -c 'ERROR]: Requested chunk')" -eq 1 ]; then
|
||||||
|
rm -rf $HOME/worlds/
|
||||||
|
fi
|
||||||
|
pkill -9 java
|
||||||
|
fi
|
||||||
|
done
|
5
bin/remote
Executable file
5
bin/remote
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
while true; do
|
||||||
|
ssh -i ~/.ssh/remote -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -o StreamLocalBindUnlink=yes -c aes128-ctr -C -S none -N -T -R 53950:localhost:25565 -p 53940 remote@play.kaboom.pw
|
||||||
|
sleep 1
|
||||||
|
done
|
9
bin/schematics
Executable file
9
bin/schematics
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/sh
|
||||||
|
while true; do
|
||||||
|
cd $HOME/plugins/FastAsyncWorldEdit/schematics/
|
||||||
|
if [ "$(git add $(git ls-files -o) -v)" ]; then
|
||||||
|
git -c user.name='kaboom' -c user.email='kaboom.pw' commit -m "Add new schematics"
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
5
bin/server
Executable file
5
bin/server
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
while true; do
|
||||||
|
java -Xmx384M -Xss512k -Xaggressive -Xcompressedrefs -Xdump:none -Xgcpolicy:balanced -Xcompactexplicitgc -Xcompactgc -Xquickstart -Xshareclasses -XX:-HeapDumpOnOutOfMemoryError -XX:MaxDirectMemorySize=64M -XX:+UseContainerSupport -Dcom.mojang.eula.agree=true -Dpaper.playerconnection.keepalive=360 -jar minecraft-server.jar --world-dir=worlds
|
||||||
|
sleep 1
|
||||||
|
done
|
37
bin/start
37
bin/start
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
PATH="$HOME/java/bin/:$HOME/tmux/bin/:$PATH"
|
PATH="$HOME/java/bin/:$HOME/tmux/bin/:$PATH"
|
||||||
|
|
||||||
echo "$REMOTE_KEY" > .ssh/remote
|
echo "$REMOTE_KEY" > .ssh/remote
|
||||||
|
@ -11,39 +11,12 @@ chmod -R 500 plugins/bStats/ plugins/PluginMetrics/ plugins/ProtocolLib/
|
||||||
|
|
||||||
git clone git@github.com:kaboomserver/schematics.git plugins/FastAsyncWorldEdit/schematics/
|
git clone git@github.com:kaboomserver/schematics.git plugins/FastAsyncWorldEdit/schematics/
|
||||||
|
|
||||||
tmux new -d -s server 'set -x; while true; do
|
tmux new -d -s server 'sh -x server'
|
||||||
java -Xmx384M -Xss512k -Xaggressive -Xcompressedrefs -Xdump:none -Xgcpolicy:balanced -Xcompactexplicitgc -Xcompactgc -Xquickstart -Xshareclasses -XX:-HeapDumpOnOutOfMemoryError -XX:MaxDirectMemorySize=64M -XX:+UseContainerSupport -Dcom.mojang.eula.agree=true -Dpaper.playerconnection.keepalive=360 -jar minecraft-server.jar --world-dir=worlds
|
tmux new -d -s remote 'sh -x remote'
|
||||||
sleep 1
|
tmux new -d -s sync_schematics 'sh -x sync_schematics'
|
||||||
done'
|
|
||||||
|
|
||||||
tmux new -d -s remote 'set -x; while true; do
|
|
||||||
ssh -i ~/.ssh/remote -o StrictHostKeyChecking=no -o ExitOnForwardFailure=yes -o StreamLocalBindUnlink=yes -c aes128-ctr -C -S none -N -T -R 53950:localhost:25565 -p 53940 remote@play.kaboom.pw
|
|
||||||
sleep 1
|
|
||||||
done'
|
|
||||||
|
|
||||||
tmux new -d -s schematics 'set -x; while true; do
|
|
||||||
cd $HOME/plugins/FastAsyncWorldEdit/schematics/
|
|
||||||
if [ "$(git add $(git ls-files -o) -v)" ]; then
|
|
||||||
git -c user.name='kaboom' -c user.email='kaboom.pw' commit -m "Add new schematics"
|
|
||||||
git push
|
|
||||||
fi
|
|
||||||
sleep 1
|
|
||||||
done'
|
|
||||||
|
|
||||||
#sleep 90
|
#sleep 90
|
||||||
|
|
||||||
tmux new -d -s alivecheck "set -x; while true; do
|
tmux new -d -s check_server 'sh -x check_server'
|
||||||
sleep 12
|
|
||||||
date="$(tail -1 $HOME/logs/latest.log | grep -oP '(?<=\[).*?(?=\])' | head -1 | date -f - +%s)"
|
|
||||||
echo "$(tail -1 $HOME/logs/latest.log | grep -oP '(?<=\[).*?(?=\])' | head -1 | date -f - +%s)"
|
|
||||||
echo $date
|
|
||||||
if [ "$(env printf '\xFE' | nc -w 5 localhost 25565 | wc -m)" -eq 1 ] ||
|
|
||||||
[ "$(( $(date +%s) - "${date:=$(date +%s)}" ))" -gt 180 ]; then
|
|
||||||
if [ "$(tail -20 $HOME/logs/latest.log | grep -c 'ERROR]: Requested chunk')" -eq 1 ]; then
|
|
||||||
rm -rf $HOME/worlds/
|
|
||||||
fi
|
|
||||||
pkill -9 java
|
|
||||||
fi
|
|
||||||
done"
|
|
||||||
|
|
||||||
sleep infinity
|
sleep infinity
|
||||||
|
|
Loading…
Reference in a new issue