This is an old revision of the document!
#!/bin/env perl # name: clean-magick-tmp # date: 20110515 # author: jason thomas <jason@lithiumfox.com> # purpose: check tmp dir for pesky image magick tmp files that are larger then 3gb use strict; my $maxsize = '3000000000'; my $tmpdir = '/tmp'; opendir (TMPDIR, $tmpdir); my @tmpfiles = readdir(TMPDIR); close (TMPDIR); foreach (@tmpfiles){ my $pathtotmp = "$tmpdir/$_"; if ($pathtotmp =~ m/^\/tmp\/magick-\w+/g){ if (-s $pathtotmp >= $maxsize){ open (FH, "<$pathtotmp"); if(tell(FH) != -1){ print "$pathtotmp is big \n"; unlink $pathtotmp; } } } }