Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1376
  • Last Modified:

Configuring the screen command to always output to a log file (screen dump file)

Hello I am a server support analyst for some RHAS3 linux servers.

I like to use the "screen" command to mirror standard output from an IBM UniData database, UniBasic program to a logfile. Everything that is normally sent to STDOUT is then also sent to the screen logfile. I can then monitor the contents of the logfile with a Perl script and do all sorts of things like email notifications.

How do I configure "screen" so that it starts writing to the screen logfile immediately after I have typed "screen<enter>"? In order to start writing to the log I am forced to press CTRL-A H but I want to avoid having to do this.

I have already tried configuring screen to always output to a logfile for root but my configuration does not seem to work even though it is configured according to the man page. (Or is it?)

I have configured my ~root/.screenrc as follows:

logfile /usr/local/scripts/fixtransp/screen.dump
logfile flush 3
log on

But when I log in as root then type "screen<enter>" the logfile does not get updated until I press CTRL-A H (case-sensitive).

Note: fixtransp is the dir of a script I'm writing to examine the screen.dump logfile and do some nice things.

Many Thanks In Advance

James
0
juggling2
Asked:
juggling2
1 Solution
 
dbardbarCommented:
Use "deflog on" instead of "log on".


Note that right after you start "screen" today, you see a little note at the butotom of the screen saying something like "log: window required". That's because you've turned on logging, before there was an active window.
deflog sets logging by default to all windows, so that solves the problem.


You would expect that if you would use the "select" command before the "log" command it would work, but it doesn't. Have no idea why. The ways of screen are mystirious indeed... :-)
0
 
juggling2Author Commented:
Thanks that works great!

I also found out that when starting screen, "screen -L" also does the same thing.

I shoulda read the manual more thoroughly :)

0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now