• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Why wont this output redirection work?

Red Squirrel

No Lifer
I'm trying to setup a script to run a UT3 server in the background, but no matter what I try, it keeps outputting all the crap to screen instead of to the file I specify. I had it working at one point and it just stopped working. This is the script:

Code:
{
./command
} > server.log 2>&1

I also tried all of these combinations:

Code:
./command > server.log 2>&1

Code:
./command &> server.log

Code:
{
./command
} &> server.log

No matter what I try, I get crap outputting to the screen that executed the command. I want ALL output to go to the file no matter what.


The actual command is longer, but it probably does not matter, but just in case it does, it's this:

Code:
./ut3 Server VCTF-Necropolis?Game=UTGameContent.UTVehicleCTFGame_Content?GameMode=2?Numplay=4?MaxPlayers=64?NumPublicConnections=24?NumPrivateConnections=2?MinNetPlayers=1?bIsDedicated=true?bUsesStats=true?ForceRespawn=0?bShouldAdvertise=false?PureServer=1?bIsLanMatch=false?bAllowJoinInProgress=true?AdminName=********?AdminPassword=******** -Login=********-Password=******** -Log=myserver.log -multihome=96.45.178.186 -unattended

Any way to force the output to a file?
 
Try a really basic server command, and if that works correctly there's a problem with your script.

What about this:

Code:
AdminPassword=******** -Login=********-Password=********

No space after -Login=********, which may just be a posting error, but otherwise needed to be pointed out.
 
You're trying to redirect stderr to stdout and then stdout to a file?
Code:
./command > file.log 2>&1
or
Code:
./command &> file.log
or
Code:
./command 2> file.log 1>&2
 
Ok, wow this is kinda hilarious, but it WAS working. The UT3 server is not very stable and crashes a lot, and I guess the last time it crashed I had tail -f on the log file as I was viewing it live. Well that process stayed stuck in the background somehow and was still running. So the output I was seeing was actually the tail -f output, not the actual command I was executing. Funny thing is I sshed out and in several times since the last time I used tail, but guess it somehow still outputted to the console, maybe it just so happened I landed on the same virtual TTY or something. Who knows.

So > file.log 2>&1 worked. I'm guessing &> works too, but since it's working now with the other way I'll just leave it at that.

So yeah, it's working now. I just found that tail was running by coincidence when I did a ps aux.
 
Back
Top