1

One of my first questions. Please comment if further explanation or information is required or if the question is not like it's supposed to be here

I'm using screen to automatically start servers (minecraft server in this example).

I'm spawning a screen like

screen -S 'server_1' -d -m "java -Xmx4G -Xms4G -jar spigot.jar"

Then setting the logfile and enabling logging with

screen -S 'server_1' -X logfile /srv/serverinstalls/1/stdout.txt
screen -S 'server_1' -X log

The contents of stdout.txt are then read in via NodeJS.

Output of "cat stdout.txt" look fine, but if I view the file with "less stdout.txt" every line starts with

>ESC[2K^M

where ^M and ESC are control characters (^M is the \r character) I think this is the way screen logs the prompt (starting with '>') of the interactive shell the server provides

Is there some way the screen-command can be configured to ommit those control character and not log the interactive part of the shell?

If needed, I can execute additional commands every time I read the logfile or somehow replace the unwanted characters using NodeJS, but the prompt doesn't look the same on every server.

I'm running on Debian 9.9 (stretch) with screen 4.05.00

0

Have tried anyone below?

ansifilter
less -r
strings
  • Using "strings stdout.txt | tail -n20" I can get the last 20 lines without control characters and prompt. Thank you very much! – Niklas Gschaider May 27 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.