2 #============================================================= -*-perl-*-
4 # BackupPC_trashClean: remove all the files in $TopDir/trash.
7 # BackupPC_trashClean is started once by BackupPC. Every 5 minutes
8 # it wakes up and removes all the files or directories in $TopDir/trash.
11 # Craig Barratt <cbarratt@users.sourceforge.net>
14 # Copyright (C) 2001-2009 Craig Barratt
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of the GNU General Public License as published by
18 # the Free Software Foundation; either version 2 of the License, or
19 # (at your option) any later version.
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #========================================================================
32 # Version 3.2.0, released 31 Jul 2010.
34 # See http://backuppc.sourceforge.net.
36 #========================================================================
40 use lib "/usr/local/BackupPC/lib";
43 die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
44 my $TopDir = $bpc->TopDir();
45 my $BinDir = $bpc->BinDir();
46 my %Conf = $bpc->Conf();
50 ###########################################################################
51 # Empty trash every so often (eg: every 5 minutes)
52 ###########################################################################
54 print("processState running\n");
55 if ( $bpc->RmTreeTrashEmpty("$TopDir/trash") < 0 ) {
56 print("log BackupPC_trashClean failed to empty $TopDir/trash\n");
58 print("processState idle\n");
59 sleep($Conf{TrashCleanSleepSec} || 300);