buildpack/bin/start

51 lines
1.8 KiB
Plaintext
Raw Normal View History

2019-08-06 16:05:19 +00:00
#!/bin/bash
2019-02-23 18:53:10 +00:00
PATH="$HOME/java/bin/:$HOME/tmux/bin/:$PATH"
2019-02-23 18:49:15 +00:00
2019-02-02 23:40:25 +00:00
echo "$REMOTE_KEY" > .ssh/remote
echo "$SYNC_KEY" > .ssh/id_rsa
chmod 600 .ssh/remote
2019-06-24 10:27:46 +00:00
ssh-keyscan github.com >> .ssh/known_hosts
2019-02-23 18:19:01 +00:00
chmod -R 500 plugins/bStats/ plugins/PluginMetrics/ plugins/ProtocolLib/
2019-02-23 18:19:01 +00:00
2019-07-24 01:55:40 +00:00
git clone git@github.com:kaboomserver/schematics.git plugins/FastAsyncWorldEdit/schematics/
2018-05-25 16:49:13 +00:00
2019-08-06 14:17:18 +00:00
tmux new -d -s server 'set -x; while true; do
2019-07-24 10:30:55 +00:00
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
2018-10-01 16:27:15 +00:00
sleep 1
2018-11-11 19:04:26 +00:00
done'
2018-05-25 16:49:13 +00:00
2019-08-06 14:17:18 +00:00
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
2018-10-01 16:27:15 +00:00
sleep 1
2018-11-11 18:57:52 +00:00
done'
2018-06-10 09:27:51 +00:00
2019-08-06 14:17:18 +00:00
tmux new -d -s schematics 'set -x; while true; do
2019-07-24 01:55:40 +00:00
cd $HOME/plugins/FastAsyncWorldEdit/schematics/
if [ "$(git add $(git ls-files -o) -v)" ]; then
2019-02-24 00:16:39 +00:00
git -c user.name='kaboom' -c user.email='kaboom.pw' commit -m "Add new schematics"
2018-11-11 19:08:51 +00:00
git push
2018-11-11 19:04:26 +00:00
fi
sleep 1
done'
2018-05-25 16:49:13 +00:00
2019-08-06 16:01:07 +00:00
#sleep 90
2018-11-13 04:08:36 +00:00
2019-08-06 13:39:21 +00:00
tmux new -d -s alivecheck "set -x; while true; do
2019-08-06 16:01:07 +00:00
sleep 12
2019-08-06 15:28:09 +00:00
DATE_PARSE=$(tail -1 latest.log | grep -oP '(?<=\[).*?(?=\])' | head -1 | date -f - +%s)
2019-08-06 16:16:33 +00:00
echo $DATE_PARSE
2019-08-06 16:23:07 +00:00
DATE=$${DATE_PARSE:=$(date +%s)}
2019-08-06 16:16:33 +00:00
echo $DATE
2019-08-06 16:01:07 +00:00
if [ "$(env printf '\xFE' | nc -w 5 localhost 25565 | wc -m)" -eq 1 ] ||
2019-08-06 15:28:09 +00:00
[ "$(( $(date +%s) - $DATE ))" -gt 180 ]; then
2019-08-06 14:00:52 +00:00
if [ "$(tail -20 $HOME/logs/latest.log | grep -c 'ERROR]: Requested chunk')" -eq 1 ]; then
2019-07-27 10:40:15 +00:00
rm -rf $HOME/worlds/
fi
2019-08-06 14:17:18 +00:00
pkill -9 java
2018-11-11 19:45:48 +00:00
fi
2019-08-06 13:39:21 +00:00
done"
2018-11-11 19:45:48 +00:00
2018-06-10 05:22:56 +00:00
sleep infinity