Skip to content
Snippets Groups Projects
Commit 771a4759 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

block prune.sh if prune-after = never

parent 86ee8dfd
No related branches found
No related tags found
1 merge request!125block prune.sh if prune-after = never
......@@ -141,6 +141,7 @@ function _getFileAge(){
function setAction(){
local action=$1
local myfile=$2
local doforce=$3
local iLimit
iLimit=$(_j_getvar ${STORAGEFILE} "${action}-after")
......@@ -154,16 +155,21 @@ function setAction(){
echo "Info: $action is ENABLED - no last $action detected"
doValue=1
else
typeset -i iLastDone
iLastDone=$( _getFileAge "${myfile}" )/60
typeset -i iLastDoneD=iLastDone/60/24
echo "Info: Last $action was $iLastDone min ago ($iLastDoneD days). Limit is $iLimit days."
if [ $iLastDoneD -ge $iLimit ]; then
echo "Info: $action is ENABLED - last $action is outdated"
if [ "$doforce" -eq "1" ]; then
echo "Force $action"
doValue=1
else
echo "Info: $action is not needed yet."
doValue=0
typeset -i iLastDone
iLastDone=$( _getFileAge "${myfile}" )/60
typeset -i iLastDoneD=iLastDone/60/24
echo "Info: Last $action was $iLastDone min ago ($iLastDoneD days). Limit is $iLimit days."
if [ $iLastDoneD -ge $iLimit ]; then
echo "Info: $action is ENABLED - last $action is outdated"
doValue=1
else
echo "Info: $action is not needed yet."
doValue=0
fi
fi
fi
}
......@@ -193,8 +199,8 @@ function setAction(){
# set defaults for prune and verify
echo ">>> Detect default behaviour:"
setAction "prune" "$lastprunefile"; doPrune=$doValue
setAction "verify" "$lastverifyfile"; doVerify=$doValue
setAction "prune" "$lastprunefile" 0; doPrune=$doValue
setAction "verify" "$lastverifyfile" 0; doVerify=$doValue
echo
echo ">>> Check parameters"
......@@ -202,7 +208,7 @@ function setAction(){
echo "Info: Forcing prune only by parameter."
ACTION=$1
doBackup=0
doPrune=1
setAction "prune" "$lastprunefile" 1; doPrune=$doValue
doVerify=0
transferlog="${DIR_LOGS}/prune-$(date +%Y%m%d-%H%M%S).log"
fi
......@@ -214,6 +220,12 @@ function setAction(){
doVerify=1
transferlog="${DIR_LOGS}/verify-$(date +%Y%m%d-%H%M%S).log"
fi
if [ "${doBackup}${doPrune}${doVerify}" = "000" ]; then
echo "Nothing to do. Aborting."
exit 0
fi
exec 1> >( tee -a "$transferlog" ) 2>&1
echo "INFO: Start logging into $transferlog"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment