-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstart.sh
executable file
·59 lines (52 loc) · 1.01 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
#!/bin/bash
DIR="$(cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
cd "$DIR"
DO_LOOP="no"
while getopts "p:f:l" OPTION 2> /dev/null; do
case ${OPTION} in
p)
PHP_BINARY="$OPTARG"
;;
f)
START_CLIENT="$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 "Couldn't find a working PHP 7 binary, please use the installer."
exit 1
fi
fi
if [ "$START_CLIENT" == "" ]; then
if [ -f ./src/client/StartClient.php ]; then
START_CLIENT="./src/client/StartClient.php"
else
echo "Couldn't find StartClient.php"
exit 1
fi
fi
LOOPS=0
set +e
while [ "$LOOPS" -eq 0 ] || [ "$DO_LOOP" == "yes" ]; do
if [ "$DO_LOOP" == "yes" ]; then
"$PHP_BINARY" "$START_CLIENT" $@
else
exec "$PHP_BINARY" "$START_CLIENT" $@
fi
((LOOPS++))
done
if [ ${LOOPS} -gt 1 ]; then
echo "Restarted $LOOPS times"
fi