forked from jammsen/docker-palworld-dedicated-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservermanager.sh
51 lines (44 loc) · 1.6 KB
/
servermanager.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
#!/bin/bash
GAME_PATH="/palworld/"
function installServer() {
# force a fresh install of all
echo ">>> Doing a fresh install of the gameserver"
/home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit
}
function updateServer() {
# force an update and validation
echo ">>> Doing an update of the gameserver"
/home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit
}
function startServer() {
echo ">>> Starting the gameserver"
cd $GAME_PATH
START_OPTIONS=""
if [[ -n $COMMUNITY_SERVER ]] && [[ $COMMUNITY_SERVER == "true" ]]; then
START_OPTIONS="$START_OPTIONS EpicApp=PalServer"
fi
if [[ -n $MULTITHREAD_ENABLED ]] && [[ $MULTITHREAD_ENABLED == "true" ]]; then
START_OPTIONS="$START_OPTIONS -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS"
fi
if [[ -n $PUBLIC_IP ]]; then
START_OPTIONS="$START_OPTIONS -publicip=$PUBLIC_IP"
fi
if [[ -n $PUBLIC_PORT ]]; then
START_OPTIONS="$START_OPTIONS -publicport=$PUBLIC_PORT"
fi
if [[ -n $SERVER_PASSWORD ]]; then
START_OPTIONS="$START_OPTIONS -serverpassword=$SERVER_PASSWORD"
fi
./PalServer.sh port="$GAME_PORT" players="$MAX_PLAYERS" "$START_OPTIONS" -servername="$SERVER_NAME"
}
function startMain() {
# Check if server is installed, if not try again
if [ ! -f "/palworld/PalServer.sh" ]; then
installServer
fi
if [ $ALWAYS_UPDATE_ON_START == "true" ]; then
updateServer
fi
startServer
}
startMain