This repository has been archived by the owner on Dec 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
79 lines (68 loc) · 1.53 KB
/
start.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# This is the start.sh file for Dyno
# Please input ./start.sh to start server
# Variable define
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
# Change Directory
cd "$DIR"
# Loop starting
# Don't edit this if you don't know what this does!
DO_LOOP="no"
##########################################
# DO NOT EDIT ANYTHING BEYOND THIS LINE! #
##########################################
while getopts "p:f:l" OPTION 2> /dev/null; do
case ${OPTION} in
p)
PHP_BINARY="$OPTARG"
;;
f)
DYNO_FILE="$OPTARG"
;;
l)
DO_LOOP="yes"
;;
\?)
break
;;
esac
done
if [ "$PHP_BINARY" == "" ]; then
if [ -f ./bin/php7/bin/php ]; then
export PHPRC=""
PHP_BINARY="./bin/php7/bin/php"
elif type php 2>/dev/null; then
PHP_BINARY=$(type -p php)
else
echo "[ERROR] Couldn't find a working PHP binary, please use the installer."
exit 1
fi
fi
if [ "$DYNO_FILE" == "" ]; then
if [ -f ./Dyno.phar ]; then
DYNO_FILE="./Dyno.phar"
elif [ -f ./src/dyno/Boot.php ]; then
DYNO_FILE="./src/dyno/Boot.php"
else
echo "[ERROR] Couldn't find a valid Dyno installation."
exit 1
fi
fi
LOOPS=0
set +e
while [ "$LOOPS" -eq 0 ] || [ "$DO_LOOP" == "yes" ]; do
if [ "$DO_LOOP" == "yes" ]; then
"$PHP_BINARY" "$DYNO_FILE" $@
else
exec "$PHP_BINARY" "$DYNO_FILE" $@
fi
if [ "$DO_LOOP" == "yes" ]; then
if [ ${LOOPS} -gt 0 ]; then
echo "Restarted $LOOPS times"
fi
echo "To escape the loop, press CTRL+C now. Otherwise, wait 5 seconds for the server to restart."
echo ""
sleep 5
((LOOPS++))
fi
done