This is very close.
But the script hangs and wont exit the "tee" command.
I ran the script using "strace" and it sits there like this.
write(1, "Backup and Replication is comple"..., 65Backup and Replication
is complete for mysite.com
) = 65
close(3) = 0
munmap(0x401fd000, 4096) = 0
rt_sigaction(SIGHUP, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN}, {SIG_DFL}, 8) = 0
wait4(3576,
And a ps-ef looks like this.
root 3576 3575 0 02:19 pts/0 00:00:00 tee YourLogFileHere
I have a close (TEE); at the end as well.
Any thoughts?
Thanks
-----Original Message-----
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 17, 2004 9:55 AM
To: [EMAIL PROTECTED]
Subject: Re: Redirect stdout, stderr to file and stdout
>>>>> "Larry" == Larry Guest <[EMAIL PROTECTED]> writes:
Larry> I have a small script that does some admin work for me. What I
Larry> need to do now is not only have is display information to STDERR
Larry> and STDOUT but also write the same information I see when I run
Larry> the command to a file.
Larry> I have written it for others who are not very technical. I want
Larry> them to be able to see the script working and what it is doing.
Larry> But I also need a log file of the same information so I can have
Larry> it mailed to me and keep a copy on the server.
Larry> I cant seem to get this to work.
I think this might do it:
open TEE, "| tee YourLogFileHere";
open STDOUT, ">&TEE";
open STDERR, ">&TEE";
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See
PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>