buildpack/bin/start

44 lines
1.3 KiB
Text
Raw Normal View History

2019-02-23 20:26:34 +02:00
#!/bin/sh
2019-02-23 20:53:10 +02:00
PATH="$HOME/java/bin/:$HOME/tmux/bin/:$PATH"
2019-02-23 20:49:15 +02:00
2019-02-03 01:40:25 +02:00
echo "$REMOTE_KEY" > .ssh/remote
echo "$SYNC_KEY" > .ssh/id_rsa
chmod 600 .ssh/remote
2019-02-24 02:16:39 +02:00
ssh-keyscan framagit.org >> .ssh/known_hosts
2019-04-18 21:21:11 +03:00
ssh-keyscan -p 53940 play.kaboom.pw >> .ssh/known_hosts
2019-02-23 20:19:01 +02:00
chmod -R 500 plugins/bStats/ plugins/PluginMetrics/ plugins/ProtocolLib/
2019-02-23 20:19:01 +02:00
2019-02-24 02:16:39 +02:00
git clone git@framagit.org:kaboom/core/schematics.git plugins/WorldEdit/schematics/
2018-05-25 19:49:13 +03:00
2019-02-23 20:49:15 +02:00
tmux new -d -s server 'while true; do
2019-03-09 22:32:44 +02:00
java -Xmx384M -Xss512k -Xaggressive -Xdump:none -Xquickstart -Xshareclasses -XX:MaxDirectMemorySize=384M -XX:-HeapDumpOnOutOfMemoryError -XX:+IdleTuningGcOnIdle -XX:+UseContainerSupport -Dcom.mojang.eula.agree=true -jar minecraft-server.jar --world-dir=worlds
2018-10-01 19:27:15 +03:00
sleep 1
2018-11-11 21:04:26 +02:00
done'
2018-05-25 19:49:13 +03:00
2019-02-23 20:49:15 +02:00
tmux new -d -s remote 'while true; do
2019-04-19 11:45:23 +03:00
ssh -i ~/.ssh/remote -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 19:27:15 +03:00
sleep 1
2018-11-11 20:57:52 +02:00
done'
2018-06-10 12:27:51 +03:00
2019-02-23 20:49:15 +02:00
tmux new -d -s schematics 'while true; do
2018-11-11 21:04:26 +02:00
cd $HOME/plugins/WorldEdit/schematics/
if [ "$(git add $(git ls-files -o) -v)" ]; then
2019-02-24 02:16:39 +02:00
git -c user.name='kaboom' -c user.email='kaboom.pw' commit -m "Add new schematics"
2018-11-11 21:08:51 +02:00
git push
2018-11-11 21:04:26 +02:00
fi
sleep 1
done'
2018-05-25 19:49:13 +03:00
2018-11-13 06:08:36 +02:00
sleep 60
2018-11-11 21:45:48 +02:00
while true; do
sleep 120
if [ "$(env printf '\xFE' | nc -w 5 localhost 25565 | wc -m)" -eq 0 ]; then
kill -9 $(pgrep java)
2018-11-11 21:45:48 +02:00
fi
done &
2018-06-10 08:22:56 +03:00
sleep infinity