Unable to specify custom output screenlog.0 file with -L flag

Asked by Demon

The screen package needs to change the -L switch feature so that a screenlog.0 filename can be given a specific directory/filename output such as doing:

screen -L /tmp/screenlog.1 (2, 3, etc)

Otherwise in order to run multiple screens with -L they each have to be executed from different directories, because they'd all output to the same screenlog.0 file.

The only alternative workaround to this is doing:

screen -dmS workspace | tee screen.log

or

screen -dmS workspace && screen -S workspace -X stuff $'<command> | tee screen.log\n'

Conclusion, To recode the -L switch to allow to explicitly specify custom filename/directory location for screenlog.0 output ?

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu screen Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

What is the output of:

lsb_release -a; uname -a; apt-cache policy screen

Thanks

Revision history for this message
Demon (demonrx) said :
#2

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
Linux UbuntuHP 4.4.0-93-generic #116-Ubuntu SMP Fri Aug 11 21:17:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
screen:
  Installed: 4.3.1-2build1
  Candidate: 4.3.1-2build1
  Version table:
 *** 4.3.1-2build1 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
     4.2.1-3 500
        500 http://archive.ubuntu.com/ubuntu vivid/main amd64 Packages
============================================================
I'm also using Screen on a server system:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
Release: 16.10
Codename: yakkety
Linux TBclient17 4.8.0-59-generic #64-Ubuntu SMP Thu Jun 29 19:38:34 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
screen:
  Installed: 4.4.0-4
  Candidate: 4.4.0-4
  Version table:
 *** 4.4.0-4 500
        500 http://nl.archive.ubuntu.com/ubuntu yakkety/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

Please see https://wiki.ubuntu.com/Releases
Ubuntu 16.10 is not supported any more, and no patches are published any more (not even for fixing critical vulnerabilities). You should upgrade your system from 16.10 to 17.04 in due course.

Revision history for this message
Manfred Hampl (m-hampl) said :
#4

According to the man pages you can use commands like

screen -L 0 command
screen -L 1 other_command

and they will write to screenlog.0 and screenlog.1 respectively. Doesn't this do what you need?

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#5

Which system is having the issue?

Revision history for this message
Demon (demonrx) said :
#6

Thanks Manfred Hampl, that solved my question.

Revision history for this message
Demon (demonrx) said :
#7

@Manfred Hampl,

Actually I just tested your method and it's not working, I get this output:

Cannot exec '1': No such file or directory

In fact, the screen session doesn't even initiate. This is on Ubuntu 16.04

Revision history for this message
Manfred Hampl (m-hampl) said :
#8

What command di you issue to receive this output?

Revision history for this message
Demon (demonrx) said :
#9

ader@UbuntuHP:~$ screen -L 1
[screen is terminating]

and I tried

ader@UbuntuHP:~$ screen -dmS test -L 1
ader@UbuntuHP:~$ screen -r
There is no screen to be resumed.

and

ader@UbuntuHP:~$ screen -S test -L 1
[screen is terminating]

and

ader@UbuntuHP:~$ screen -dmS test -L 1; screen -S test -X stuff $'free\n'
No screen session found.

All fail to start a screen session

Revision history for this message
Manfred Hampl (m-hampl) said :
#10

Sorry, it seems that i misread the man pages.
The commands that I gave can be put into the ~/.screenrc file.

Maybe you should create a bug report (probably better even in the GNU bug tracker, because that assumedly is not Ubuntu-specific).

Revision history for this message
Demon (demonrx) said :
#11

Indeed, however it's technically not a bug, just a lacking feature. But I'll report it.

Can you help with this problem?

Provide an answer of your own, or ask Demon for more information if necessary.

To post a message you must log in.