[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Auto-logging does not start for detached session

From: Alexander Kriegisch
Subject: Auto-logging does not start for detached session
Date: Fri, 16 Feb 2007 01:31:13 +0100
User-agent: Thunderbird (Windows/20061207)

I tried the following with screen 4.00.02, both on my DSL router
(Fritz!Box running a modified Firmware based on Kernel and on
Ubuntu 6.10 running on a regular x86 Pc (well, almost regular: VMware
Player hosten on WinXP).

What I am trying to do is the following:
  - Create a detached screen session in a startup script so as to have
    some kind of persistent session running on the box.
  - Activate logging.
  - The session is never supposed to be attached to a real terminal.
    Instead, I am sending commands to it via a CGI script controlled by
    a client using a web browser. I am using the '-X exec' option for
    that purpose.
  - The CGI script should gather the command's output from the log file
    and return it to the calling web client so the user can see the
    result of his action.

The whole thing is supposed to be a cheap replacement for tools like
cgi-shell, Anyterm etc. They don't run on my router for technical
reasons that do not matter here. I could issue each command in a new
shell session, but I want to be able to preserve a shell session's state
between calls. This is why I am using screen.

Having explained all this for your understanding, here is the actual
problem: Logging never really starts before I explicitly attach the
detached session at least once. After the login message has been saved
to the logfile, nothing else is logged anymore. Attaching and detaching
the session again fixes this behaviour.

Sample script:


# start clean session
rm -rf $DIR
mkdir $DIR
cd $DIR

# create detached screen session with auto-logging
screen -dm -L -S fritzterm
# maybe decreasing the flush interval helps?
screen -S fritzterm -X logfile flush 0
# issue remote command inside the session
screen -S fritzterm -X exec ls -l /

# wait a moment, then check log file's content
sleep 2
cat /var/tmp/fritzterm/screenlog.0

Unfortunately the effect is as described above. No logging whatsoever,
no matter hown many commands are issued to the screen session. Attaching
the session shows the same: nothing except the shell's welcome message
is there. But from that moment on evetything is neatly logged, no matter
if the session is attached or detached.

How can I solve this problem?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]