in reply to Suggestions on cleaning up session files
I'm thinking of using cron and reading the files' dates
That's exactly what I do. Works like a charm.
Sample code:
my $tmp_path = "/tmp/myapp"; my $max_age = 60*60*24; # e.g. one day my $t_keep = time() - $max_age; my @stale_sessfiles = grep { (stat $_)[9] < $t_keep } # files older than $t_keep glob "$tmp_path/cgisess_*"; # print STDERR "$_\n" for @stale_sessfiles; # debug unlink @stale_sessfiles;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Suggestions on cleaning up session files
by Anonymous Monk on Mar 20, 2009 at 15:04 UTC | |
by almut (Canon) on Mar 20, 2009 at 15:19 UTC |