-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9846 from jonasraoni/bugfix/stable-3_4_0/9833-fix…
…-preflight-check #9833 Updated pre-flight script to extract the date from t…
- Loading branch information
Showing
2 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# @file tools/travis/migration/v3_4_0/prepare-logs.sh | ||
# | ||
# Copyright (c) 2024 Simon Fraser University | ||
# Copyright (c) 2024 John Willinsky | ||
# Distributed under the GNU GPL v3. For full terms see the file docs/COPYING. | ||
# | ||
# Script to adjust at maximum two logs to run the tests for the 3.4 migration. | ||
# | ||
# @todo: Remove once the 3.4 upgrade code gets dropped | ||
# | ||
|
||
set -e | ||
|
||
# Get the list of logs | ||
eventLogsFolder="${FILESDIR}/usageStats/usageEventLogs" | ||
logFiles=("${eventLogsFolder}/"*) | ||
archiveFolder="${FILESDIR}/usageStats/archive" | ||
mkdir -p ${archiveFolder} | ||
|
||
# Get the current and previous date in YMD format | ||
today=$(date +"%Y%m%d") | ||
yesterday=$(date -d "1 day ago" +"%Y%m%d") | ||
|
||
# Rename the first two logs | ||
if [ -e "${logFiles[0]}" ]; then | ||
mv "${logFiles[0]}" "${eventLogsFolder}/${today}.log" | ||
fi | ||
if [ -e "${logFiles[1]}" ]; then | ||
mv "${logFiles[1]}" "${eventLogsFolder}/${yesterday}.log" | ||
fi | ||
|
||
# Move the remaining logs to the archive folder | ||
for file in "${logs[@]:2}"; do | ||
mv "${file}" "${archiveFolder}/" | ||
done |