mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-20 19:49:44 +00:00
Update start.sh
This commit is contained in:
parent
219160dc15
commit
7ac6e5614b
1 changed files with 57 additions and 5 deletions
62
start.sh
62
start.sh
|
|
@ -1,8 +1,60 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
|
||||
cd "$DIR"
|
||||
while [ true ]
|
||||
do
|
||||
./bin/php5/bin/php -d enable_dl=On PocketMine-MP.php $@
|
||||
echo "Restarting the server..."
|
||||
|
||||
while getopts "p:f:l" OPTION 2> /dev/null; do
|
||||
case ${OPTION} in
|
||||
p)
|
||||
PHP_BINARY="$OPTARG"
|
||||
;;
|
||||
f)
|
||||
POCKETMINE_FILE="$OPTARG"
|
||||
;;
|
||||
l)
|
||||
DO_LOOP="yes"
|
||||
;;
|
||||
\?)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$PHP_BINARY" == "" ]; then
|
||||
if [ -f ./bin/php5/bin/php ]; then
|
||||
export PHPRC=""
|
||||
PHP_BINARY="./bin/php5/bin/php"
|
||||
elif [[ ! -z $(type php) ]]; then
|
||||
PHP_BINARY=$(type -p php)
|
||||
else
|
||||
echo "Couldn't find a PHP binary in system PATH or $PWD/bin/php5/bin"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$POCKETMINE_FILE" == "" ]; then
|
||||
if [ -f ./PocketMine-MP.php ]; then
|
||||
POCKETMINE_FILE="./PocketMine-MP.php"
|
||||
else
|
||||
echo "PocketMine-MP.php not found"
|
||||
echo "Downloads can be found at https://github.com/kotyaralih/NostalgiaCore"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
LOOPS=0
|
||||
|
||||
set +e
|
||||
|
||||
if [ "$DO_LOOP" == "yes" ]; then
|
||||
while true; do
|
||||
if [ ${LOOPS} -gt 0 ]; then
|
||||
echo "Restarted $LOOPS times"
|
||||
fi
|
||||
"$PHP_BINARY" "$POCKETMINE_FILE" $@
|
||||
echo "To escape the loop, press CTRL+C now. Otherwise, wait 2 seconds for the server to restart."
|
||||
sleep 2
|
||||
((LOOPS++))
|
||||
done
|
||||
else
|
||||
exec "$PHP_BINARY" "$POCKETMINE_FILE" $@
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue