Ticket #2551: 0001-two-fixes-for-myth_archive_job.pl.txt

File 0001-two-fixes-for-myth_archive_job.pl.txt, 1.3 KB (added by Janne <janne-mythtv@…>, 17 years ago)
Line 
1From db0257ab0867be865497da2874db5c9c60ef0b9c Mon Sep 17 00:00:00 2001
2From: Janne Grunau <janne@tjalk.(none)>
3Date: Sun, 8 Oct 2006 21:41:31 +0200
4Subject: [PATCH] two fixes for myth_archive_job.pl
5
6file size is already in MB while checking for enough free space
7enforce df output in one column even for long device names / mount points
8---
9 mythtv/contrib/myth_archive_job.pl |    4 ++--
10 1 files changed, 2 insertions(+), 2 deletions(-)
11
12diff --git a/mythtv/contrib/myth_archive_job.pl b/mythtv/contrib/myth_archive_job.pl
13index afa4546..997e0b0 100755
14--- a/mythtv/contrib/myth_archive_job.pl
15+++ b/mythtv/contrib/myth_archive_job.pl
16@@ -72,7 +72,7 @@ if ( $archiveDir ) {
17                        printf( "    Curr Free: %6d MB\n", $freeSpace );
18                }
19 
20-               if (( $freeSpace - ($size / 1024.0 / 1024.0)) > $keepFree ) {
21+               if (( $freeSpace - $size ) > $keepFree ) {
22                        printf( "Attempting archive to %s\nStatus: ", $archiveDir );
23                        if (MoveFileToArchiveDir( $file, $directory, $archiveDir )) {
24                                printf( "Success.\n" );
25@@ -97,7 +97,7 @@ sub GetFreeSpace {
26        if ( ! -r $dir ) {
27                return 0;
28        } else {
29-               my( $freeSpace ) = `df -m $dir | grep -v Available | awk '{print \$4}'`;
30+               my( $freeSpace ) = `df -Pm $dir | grep -v Available | awk '{print \$4}'`;
31 
32                return $freeSpace;
33        }
34--
351.4.2.3
36