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 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 2.0.0beta2, released 13 Apr 2003.
34 # See http://backuppc.sourceforge.net.
36 #========================================================================
39 use lib "/usr/local/BackupPC/lib";
42 die("BackupPC::Lib->new failed\n") if ( !(my $bpc = BackupPC::Lib->new) );
43 my $TopDir = $bpc->TopDir();
44 my $BinDir = $bpc->BinDir();
45 my %Conf = $bpc->Conf();
49 ###########################################################################
50 # Empty trash every so often (eg: every 5 minutes)
51 ###########################################################################
53 print("processState running\n");
54 if ( $bpc->RmTreeTrashEmpty("$TopDir/trash") < 0 ) {
55 print("log BackupPC_trashClean failed to empty $TopDir/trash\n");
57 print("processState idle\n");
58 sleep($Conf{TrashCleanSleepSec} || 300);