#! /usr/bin/env perl use strict; use warnings; # Part of backupServer package. This module gets the size of the backup, in bytes, an prints # it to STDOUT, where it is captured by backupServer my $rootDir = shift; my $client = shift; my $server = shift; my $confDir = shift; sub getSizeOnDisk { $rootDir = shift; my $size = `df -m $rootDir | grep '$rootDir'`; my ($mount,$total,$used,$free,$percent) = split( /\s+/, $size ); return "Directory Size On Server: $used out of $total megabytes available ($percent)\n"; } die "Invalid Call, exiting" unless ( $rootDir && $client && $server && $confDir ); die "Invalid Path for getStats, exiting" unless -d "$rootDir/$client/$server"; print &getSizeOnDisk( "$rootDir/$client/$server" ); 1;