Compressing right after script runs
This commit is contained in:
@@ -172,3 +172,5 @@ elif [[ -n $CLEAN ]] || [[ $(date +%a) == "Friday" ]]; then
|
||||
clean Pukeko-XYZ-Containers
|
||||
clean Pukeko-XYZ-Cloud
|
||||
fi
|
||||
#Wrap up this run's log and report nicely
|
||||
end_logging
|
||||
|
||||
22
Okiru
22
Okiru
@@ -57,6 +57,12 @@ logging () {
|
||||
zstd -11 --rm -f "$(dirname $LOG)/$(basename $LOG)_"$OLD_LOG_DATE"_"$OLD_LOG_TIME"" > /dev/null 2>&1
|
||||
# ^ Append timestamp (YYYYMMDD_HHMMSS - ex 20210301_093543) to log if it exists
|
||||
fi
|
||||
if [[ -f "$REPORT" ]]; then
|
||||
OLD_REPORT_DATE=$(stat $REPORT | grep Modify | awk '{print $2}' | sed -e 's/-//g')
|
||||
OLD_REPORT_TIME=$(stat $REPORT | grep Modify | awk '{print $3}' | sed -e 's/://g' | awk -F. '{print $1}')
|
||||
mv "$REPORT" "$(dirname $REPORT)/$(basename $REPORT)_"$OLD_REPORT_DATE"_"$OLD_REPORT_TIME"" 2> /dev/null 2>&1
|
||||
zstd -11 --rm -f "$(dirname $REPORT)/$(basename $REPORT)_"$OLD_REPORT_DATE"_"$OLD_REPORT_TIME"" > /dev/null 2>&1
|
||||
fi
|
||||
touch $LOG
|
||||
touch $REPORT
|
||||
#Greeter
|
||||
@@ -128,3 +134,19 @@ lock () {
|
||||
rm -rf $1
|
||||
fi
|
||||
}
|
||||
#Same as logging function opener, for scripts that need to wrap things up nicely
|
||||
end_logging () {
|
||||
if [[ -f "$LOG" ]]; then
|
||||
OLD_LOG_DATE=$(stat $LOG | grep Modify | awk '{print $2}' | sed -e 's/-//g')
|
||||
OLD_LOG_TIME=$(stat $LOG | grep Modify | awk '{print $3}' | sed -e 's/://g' | awk -F. '{print $1}')
|
||||
mv "$LOG" "$(dirname $LOG)/$(basename $LOG)_"$OLD_LOG_DATE"_"$OLD_LOG_TIME"" 2> /dev/null 2>&1
|
||||
zstd -11 --rm -f "$(dirname $LOG)/$(basename $LOG)_"$OLD_LOG_DATE"_"$OLD_LOG_TIME"" > /dev/null 2>&1
|
||||
# ^ Append timestamp (YYYYMMDD_HHMMSS - ex 20210301_093543) to log if it exists
|
||||
fi
|
||||
if [[ -f "$REPORT" ]]; then
|
||||
OLD_REPORT_DATE=$(stat $REPORT | grep Modify | awk '{print $2}' | sed -e 's/-//g')
|
||||
OLD_REPORT_TIME=$(stat $REPORT | grep Modify | awk '{print $3}' | sed -e 's/://g' | awk -F. '{print $1}')
|
||||
mv "$REPORT" "$(dirname $REPORT)/$(basename $REPORT)_"$OLD_REPORT_DATE"_"$OLD_REPORT_TIME"" 2> /dev/null 2>&1
|
||||
zstd -11 --rm -f "$(dirname $REPORT)/$(basename $REPORT)_"$OLD_REPORT_DATE"_"$OLD_REPORT_TIME"" > /dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user