ci-tools/run-britney

38 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-12-03 21:29:53 -06:00
#!/bin/bash
#
# Copyright (C) 2024 Simon Quigley <tsimonq2@ubuntu.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2024-12-03 22:03:23 -06:00
# Configuration
2024-12-03 21:29:53 -06:00
LOG_DIR="/srv/lubuntu-ci/output/logs/britney"
2024-12-03 21:44:56 -06:00
SCRIPT_PATH="/srv/lubuntu-ci/repos/ci-tools/fetch-indexes"
2024-12-03 21:29:53 -06:00
# Ensure the log directory exists
2024-12-03 21:34:40 -06:00
mkdir -p $LOG_DIR
2024-12-03 21:29:53 -06:00
# Log rotation: Remove logs older than MAX_LOG_AGE
2024-12-03 21:34:40 -06:00
find $LOG_DIR -type f -mtime +1 -exec rm -f {} \;
2024-12-03 21:29:53 -06:00
# Execute the fetch-indexes script for each release and log output
for release in plucky oracular noble; do
export RELEASE="$release"
# Log file named by current UTC time (HH-MM-SS)
2024-12-03 22:03:23 -06:00
LOG_FILE="$LOG_DIR/${release}_$(date -u +"%H-%M-%S").log"
2024-12-03 21:29:53 -06:00
echo "$(date -u +"%Y-%m-%d %H:%M:%S") - Running Britney for $RELEASE" >> "$LOG_FILE"
"$SCRIPT_PATH" >> "$LOG_FILE" 2>&1
done