2

I have been using gnu-screen's 'logfile' command to log my session histories when making production changes. I like to log each change in a different directory; this means that whenever I start a new change, I need to execute the :logfile /path/to/change/directory/%t.log command again. I was wondering if there is a way to specify a logfile string when invoking screen?

The goal here is to be able to write a wrapper script, e.g. startchange [changenumber] which would then change to the correct change directory and configure screen to log any sessions in that directory.

The only solution I can think of at the moment is to have a script that makes a copy of my global .screenrc, replaces the logfile string, and invokes screen with the '-c' command line option. (screen doesn't appear to support reading multiple config files either.) This feels like a fairly heavyweight solution to what should be a fairly simple problem. Does anyone have any alternative approaches?

1

screen puts it's output in the current directory, so could you instead have a wrapper script something like:

#!/bin/sh

X="`pwd`"
mkdir -p /path/to/logs/change-$1
cd /path/to/logs/change-$1
screen -L
cd $X

Not sure if this has any problems itself, but may give you another path to follow?

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.