Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes and improvements #52

Merged
merged 8 commits into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
#!/bin/bash
s=/mnt/vrising/server
p=/mnt/vrising/persistentdata
echo "Setting timezone to $TZ"
echo $TZ > /etc/timezone 2>&1
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime 2>&1
dpkg-reconfigure -f noninteractive tzdata 2>&1

term_handler() {
echo "Shutting down Server"

PID=$(pgrep -f "^${s}/VRisingServer.exe")
kill -n 15 $PID
wait $PID
wineserver -k
sleep 1
exit
}

trap 'term_handler' SIGTERM

if [ ! -z $UID ]; then
usermod -u $UID docker 2>&1
fi
if [ ! -z $GID ]; then
groupmod -g $GID docker 2>&1
fi
if [ -z $SERVERNAME ]; then
if [ -z "$SERVERNAME" ]; then
SERVERNAME="trueosiris-V"
fi
if [ -z $WORLDNAME ]; then
if [ -z "$WORLDNAME" ]; then
WORLDNAME="world1"
fi
game_port=""
Expand All @@ -34,7 +44,7 @@ echo " "
echo "steam_appid: "`cat $s/steam_appid.txt`

echo " "
if ! grep -o 'avx[^ ]*' /proc/cpuinfo; then
if ! grep -q -o 'avx[^ ]*' /proc/cpuinfo; then
unsupported_file="VRisingServer_Data/Plugins/x86_64/lib_burst_generated.dll"
echo "AVX or AVX2 not supported; Check if unsupported ${unsupported_file} exists"
if [ -f "${s}/${unsupported_file}" ]; then
Expand All @@ -53,6 +63,14 @@ if [ ! -f "$p/Settings/ServerHostSettings.json" ]; then
echo "$p/Settings/ServerHostSettings.json not found. Copying default file."
cp "$s/VRisingServer_Data/StreamingAssets/Settings/ServerHostSettings.json" "$p/Settings/" 2>&1
fi

# Checks if log file exists, if not creates it
# Needed for fresh install
if ! [ -f "${p}/VRisingServer.log" ]; then
echo "Creating ${p}/VRisingServer.log"
touch $p/VRisingServer.log
fi

cd "$s"
echo "Starting V Rising Dedicated Server with name $SERVERNAME"
echo "Trying to remove /tmp/.X0-lock"
Expand All @@ -62,7 +80,17 @@ echo "Starting Xvfb"
Xvfb :0 -screen 0 1024x768x16 &
echo "Launching wine64 V Rising"
echo " "
<<<<<<< fixes
DISPLAY=:0.0 wine64 /mnt/vrising/server/VRisingServer.exe -persistentDataPath $p -serverName "$SERVERNAME" -saveName "$WORLDNAME" -logFile "$p/VRisingServer.log" "$game_port" "$query_port" 2>&1 &

# Gets the PID of the last command
ServerPID=$!
=======
DISPLAY=:0.0 wine64 /mnt/vrising/server/VRisingServer.exe -persistentDataPath $p -serverName "$SERVERNAME" -saveName "$WORLDNAME" -logFile "$p/VRisingServer.log" "$game_port" "$query_port" 2>&1

/usr/bin/tail -f /mnt/vrising/persistentdata/VRisingServer.log
>>>>>>> main

# Tail log file and waits for Server PID to exit
/usr/bin/tail -n 0 -f $p/VRisingServer.log &
wait $ServerPID