buildpack/script/init.sh

29 lines
700 B
Bash
Raw Normal View History

#!/bin/sh
2019-11-30 20:21:21 +02:00
# This is the core script that Heroku uses when booting up a dyno
2019-11-30 20:37:28 +02:00
PATH="$HOME/dtach/bin/:$HOME/java/bin/:$PATH"
2019-02-23 20:49:15 +02:00
2019-11-30 20:05:23 +02:00
# Set up SSH for proxy server and schematics repository
# Load keys from environmental variables
2019-11-30 20:05:23 +02:00
echo "$PROXY_KEY" > .ssh/proxy
chmod 600 .ssh/proxy
2019-02-23 20:19:01 +02:00
2019-11-30 20:05:23 +02:00
echo "$SCHEMATIC_KEY" > .ssh/id_rsa
ssh-keyscan github.com >> .ssh/known_hosts
2019-02-23 20:19:01 +02:00
2019-11-30 20:05:23 +02:00
# Run scripts for starting the Minecraft server, reverse proxy and schematic
# checker in the background
2018-05-25 19:49:13 +03:00
2019-09-05 00:16:35 +03:00
while true; do
2019-11-30 20:51:52 +02:00
dtach -n server 'script/server.sh'
dtach -n proxy 'script/proxy.sh'
dtach -n schematics 'script/schematics.sh'
2019-09-05 00:16:35 +03:00
sleep 5
2019-09-17 21:21:00 +03:00
done &
2018-05-25 19:49:13 +03:00
2019-11-30 20:05:23 +02:00
# Keep this startup script alive to prevent Heroku from stopping the server
2018-06-10 08:22:56 +03:00
sleep infinity