Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Changed logging to work properly (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vatyx authored Feb 7, 2019
1 parent f2c7dc2 commit 84ac539
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,29 @@ public static class Build
@"#!/bin/bash
NEW_USER=unrealworker
WORKER_ID=$1
shift 1
LOG_FILE=$2
shift 2
# 2>/dev/null silences errors by redirecting stderr to the null device. This is done to prevent errors when a machine attempts to add the same user more than once.
useradd $NEW_USER -m -d /improbable/logs/UnrealWorker/Logs 2>/dev/null
chown -R $NEW_USER:$NEW_USER $(pwd) 2>/dev/null
chmod -R o+rw /improbable/logs 2>/dev/null
# Create log file in case it doesn't exist and redirect stdout and stderr to the file.
touch ""${{LOG_FILE}}""
exec 1>>""${{LOG_FILE}}""
exec 2>&1
SCRIPT=""$(pwd)/{0}Server.sh""
if [ ! -f $SCRIPT ]; then
echo ""Expected to run ${{SCRIPT}} but file not found!""
exit 1
fi
chmod +x $SCRIPT
gosu $NEW_USER ""${{SCRIPT}}"" ""$@"" 2> >(grep -v xdg-user-dir >&2)";
echo ""Running ${{SCRIPT}} to start worker...""
gosu $NEW_USER ""${{SCRIPT}}"" ""$@""";


// This is for internal use only. We do not support Linux clients.
Expand Down

0 comments on commit 84ac539

Please sign in to comment.