So I've got a bash script (run as a cron job) that currently runs tar
and redirects stdout and stderr to particular files.
I'd like to run the tar command through screen so that I can check in
on the process; also, the archive now spans two tapes, so using screen
will hold the process so I can swap manually and respond interactively
to tar's request for a new tape. To do this, I first tried just
prepending screen to the existing command:
/usr/bin/screen -dm tar [options] 2>{$file1} | tee {$file2}
Unfortunately, that doesn't work. Screen seems to initiate a new
(detached) session and run tar fine, but tar's output never makes it
to $file1 and $file2. I'm assuming that, in this setup, that's because
2> and tee are capturing output from screen instead of tar, and screen
has no output. After the run, $file1 and $file2 have been created, but
they're empty.
I tried just quoting the whole command, including the redirect, and
that didn't work: the stderr output file wasn't even created. My test,
if you're curious, was:
/usr/bin/screen -dm "rm asdflkjh 2> rm.log"
Running just the quoted portion from the interactive shell ("asdflkjh"
doesn't exist) creates rm.log with the expected "cannot lstat"
message, but the full command above doesn't even create the rm.log
file. The command *without* the quotes creates rm.log, but it's empty
because screen's stderr is null.
Ideas, anyone?
--
Brad Beyenhof http://augmentedfourth.com
If they can get you asking the wrong questions, they don't have to worry
about the answers.
~ Thomas Pynchon, writer (1937- )
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list