From 807a3e6e5652e46efac57ea4ae5a854a1d6c2816 Mon Sep 17 00:00:00 2001 From: dougbtv Date: Mon, 25 Apr 2016 10:45:44 -0400 Subject: [PATCH] [bugfix] path location did not work when working from cron (e.g. without cwd context), also argument assignment was incorrect (replaced 1 with 0 in @ARGV) --- scripts/new/homer_mysql_rotate.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/new/homer_mysql_rotate.pl b/scripts/new/homer_mysql_rotate.pl index 63f6e63..5e29137 100755 --- a/scripts/new/homer_mysql_rotate.pl +++ b/scripts/new/homer_mysql_rotate.pl @@ -24,8 +24,15 @@ use POSIX; $version = "1.0.0"; -$config = $ARGV[1] // "rotation.ini"; -@stepsvalues = (86400, 3600, 1800, 900); + +# Determine path and set default rotation.ini location +$script_location = `dirname $0`; +$script_location =~ s/^\s+|\s+$//g; +$default_ini = $script_location."/rotation.ini"; + +$config = $ARGV[0] // $default_ini; + +@stepsvalues = (86400, 3600, 1800, 900); $AFTER_FIX = 1; # Optionally load override configuration. perl format