buildpack/script/init.sh

29 lines
694 B
Bash
Raw Normal View History

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