[Chicago-talk] writing a log with Cron, Daemons, Perl

Steven Lembark lembark at jeeves.wrkhors.com
Fri Sep 12 00:33:04 CDT 2003



--On Thursday, September 11, 2003 21:40:45 -0500 Jay Strauss 
<me at heyjay.com> wrote:

> Steve,
>
> Why do you do the -t test?  And which file is it testing that it's opened
> to a tty?

STDIN, if stdin is not a tty then you are running detached and need a
logfile; else you are ona tty and want to display to the screen.

> Jay
>> unless( -t )
>> {
>>     use Basename;
>>
>>     my $base = (fileparse $0, '\..*')[0];
>>     open STDOUT, '>', "$logdir/$base.out";
>>     open STDERR, '>', "$logdir/$base.err";
>>
>>     select STDERR;
>>     $| = 1;
>>
>>     select STDOUT;
>> }
>>
>>
>> --
>> Steven Lembark                                            2930 W. Palmer
>> Workhorse Computing                                    Chicago, IL 60647
>>                                                          +1 888 910 1206
>> _______________________________________________
>> Chicago-talk mailing list
>> Chicago-talk at mail.pm.org
>> http://mail.pm.org/mailman/listinfo/chicago-talk
>>
>>
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk



-- 
Steven Lembark                                            2930 W. Palmer
Workhorse Computing                                    Chicago, IL 60647
                                                         +1 888 910 1206



More information about the Chicago-talk mailing list