reorganize and optimize start.sh (#2267)

This commit is contained in:
David Schwartz 2018-06-29 09:48:29 -04:00 committed by Dylan K. Taylor
parent d0c4463773
commit e0818e7e52

View File

@ -2,8 +2,6 @@
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)" DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
cd "$DIR" cd "$DIR"
DO_LOOP="no"
while getopts "p:f:l" OPTION 2> /dev/null; do while getopts "p:f:l" OPTION 2> /dev/null; do
case ${OPTION} in case ${OPTION} in
p) p)
@ -46,19 +44,18 @@ fi
LOOPS=0 LOOPS=0
set +e set +e
while [ "$LOOPS" -eq 0 ] || [ "$DO_LOOP" == "yes" ]; do
if [ "$DO_LOOP" == "yes" ]; then
"$PHP_BINARY" "$POCKETMINE_FILE" $@
else
exec "$PHP_BINARY" "$POCKETMINE_FILE" $@
fi
if [ "$DO_LOOP" == "yes" ]; then if [ "$DO_LOOP" == "yes" ]; then
while true; do
if [ ${LOOPS} -gt 0 ]; then if [ ${LOOPS} -gt 0 ]; then
echo "Restarted $LOOPS times" echo "Restarted $LOOPS times"
fi fi
"$PHP_BINARY" "$POCKETMINE_FILE" $@
echo "To escape the loop, press CTRL+C now. Otherwise, wait 5 seconds for the server to restart." echo "To escape the loop, press CTRL+C now. Otherwise, wait 5 seconds for the server to restart."
echo "" echo ""
sleep 5 sleep 5
((LOOPS++)) ((LOOPS++))
fi
done done
else
exec "$PHP_BINARY" "$POCKETMINE_FILE" $@
fi