0

I'm tired of trying to make output of a screen program to a file..

I saw the related topic but it didn't help me.

I've tried:

script -a -t 0 out.txt screen myprogram parameters
screen myprogram parameters > out.txt
screen myprogram parameters >> out.txt
screen myprogram parameters 2> out.txt
screen myprogram parameters 2>> out.txt
screen myprogram parameters &> out.txt
screen myprogram parameters &>> out.txt
screen myprogram parameters | tee out.txt
screen myprogram parameters | tee -a out.txt
screen myprogram parameters |& tee out.txt
screen -L myprogram parameters
screen -L out.txt myprogram parameters

Nothing doesn't work...

UnityMan
  • 1
  • 3

1 Answers1

0

I think, you did a mistake with the syntax of your last try. It should be:

screen -L myprogram parameters

The result is in the screenlog.? file.

You can change that in the ~/.screenrc, if desired:

echo "logfile LOGFILE" >> ~/.screenrc
caylee
  • 921
  • 6
  • 12
  • I've already tried `screen -L myprogram parameters` but there is no `screenlog.?` file. – UnityMan Oct 28 '17 at 07:56
  • Is there any other (screen-created) file in the directory? – caylee Oct 28 '17 at 07:57
  • Nope, there is no more other screen-created file in home directory. – UnityMan Oct 28 '17 at 07:59
  • I know the question is probably not necessary, but anyway: Does `myprogram parameters` really work, maybe a spelling mistake in your tests? – caylee Oct 28 '17 at 08:01
  • By the way, does it need to be a run via screen? If not, `cmd 2>&1 >file.txt` would just work. Add `&` to run in background, as always. If it needs to, why? – caylee Oct 28 '17 at 08:14
  • I need it because I connect to Ubuntu via SSH-session. So if i wouldn't use screen I will probably close program just by closing window terminal... Screen allows to look at program and get it worked after even closing windows with the terminal. U got me? – UnityMan Oct 28 '17 at 08:17