-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServerStart.sh
58 lines (48 loc) · 1.52 KB
/
ServerStart.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
#!/bin/sh
cd "$(dirname "$0")"
. ./settings.sh
# makes things easier if script needs debugging
if [ x$FTB_VERBOSE = xyes ]; then
set -x
fi
# cleaner code
eula_false() {
grep -q 'eula=false' eula.txt
return $?
}
start_server() {
"$JAVACMD" -server -Xms512M -Xmx2048M -XX:PermSize=256M -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+CMSClassUnloadingEnabled -XX:ParallelGCThreads=2 -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -jar FTBServer-1.7.10-1614.jar nogui
}
# run install script if MC server or launchwrapper s missing
if [ ! -f $JARFILE -o ! -f libraries/$LAUNCHWRAPPER ]; then
echo "Missing required jars. Running install script!"
sh ./FTBInstall.sh
fi
# check if there is eula.txt and if it has correct content
if [ -f eula.txt ] && eula_false ; then
echo "Make sure to read eula.txt before playing!"
echo "To exit press <enter>"
read ignored
exit
fi
# inform user if eula.txt not found
if [ ! -f eula.txt ]; then
echo "Missing eula.txt. Startup will fail and eula.txt will be created"
echo "Make sure to read eula.txt before playing!"
echo "To continue press <enter>"
read ignored
fi
echo "Starting server"
rm -f autostart.stamp
start_server
while [ -e autostart.stamp ] ; do
rm -f autostart.stamp
echo "If you want to completely stop the server process now, press Ctrl+C before the time is up!"
for i in 5 4 3 2 1; do
echo "Restarting server in $i"
sleep 1
done
echo "Rebooting now!"
start_server
echo "Server process finished"
done