Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Close a file and reopen a new one at midnight

by aitap (Deacon)
on Jan 14, 2013 at 18:44 UTC ( #1013258=note: print w/replies, xml ) Need Help??


in reply to Close a file and reopen a new one at midnight

It looks like you are running a UNIX-like system. You may want to install a signal handler to reopen the filehandle and either alarm at midnight (and catch the ALRM signal) or send some signal (USR1, for example) via cron daemon and handle it. You can even automatically compress and/or remove old files using logrotate if you want.
Sorry if my advice was wrong.
  • Comment on Re: Close a file and reopen a new one at midnight

Replies are listed 'Best First'.
Re: Close a file and reopen a new one at midnight
by 0day (Sexton) on Jan 14, 2013 at 19:18 UTC
    my $timeout = 24*60*60 - ($hour*3600 + $min*60 + $sec); while(1) { eval { local $SIG{ALRM} = sub { die; }; alarm($timeout); while (my $line = <$sock>) { ................. } alarm(0); }; $timeout = 24*60*60; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013258]
help
Chatterbox?
[1nickt]: ( The 17" monster I just bought is for my wife, who doesn;t leave the house with it...)
[Corion]: 1nickt: No, I'm using it with Windows 10, but with the 4k display, yes. It's a very nice build IMO, and relatively sturdy. Also, it got 8 or 9 on the ifixit repair scale, which I consider good
[Corion]: ... especially as I expect to have to replace the battery set in two or three years' time
[1nickt]: Nice. So happy that Dells are still user-repairable. Unusual these days.
[1nickt]: I will certainly not be buying any more Macs.
[Corion]: 1nickt: Yeah, or at least, I hopoe so ;)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2017-03-27 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.