From 38b3d7f3855cb2a8eb17b1e45611da67127cbcfb Mon Sep 17 00:00:00 2001 From: Cannon Lock Date: Fri, 27 Sep 2024 10:04:01 -0500 Subject: [PATCH] Add some debugging info --- README.md | 4 ++-- crontab | 3 ++- logrotate.sh | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 478f469..13dab45 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ source .env python3 import-script/import_logs.py "$LOG_PATH" --dry-run --url "$MATOMO_URL" --token-auth "$API_TOKEN" # Print out the command that was just ran -echo "python3 import-script/import_logs.py \"$LOG_PATH\" --dry-run --url \"$MATOMO_URL\" --token-auth \"$API_TOKEN\"" +echo "python3 import-script/import_logs.py \"$LOG_PATH\" --url \"$MATOMO_URL\" --token-auth \"$API_TOKEN\"" ``` ## The Docker Image ```bash docker build -t matomo-log-scraper:latest . -docker run --env-file .env --rm -it matomo-log-scraper:latest +docker run --env-file .env --rm -it -v $PWD/test-logs:/app/test-logs matomo-log-scraper:latest ``` diff --git a/crontab b/crontab index 0ff2cad..d0f8add 100644 --- a/crontab +++ b/crontab @@ -1,2 +1,3 @@ # Run logrotate.sh daily at midnight -0 0 * * * /app/logrotate.sh >> /var/log/cron.log 2>&1 +* * * * * /app/logrotate.sh >> /var/log/cron.log 2>&1 +* * * * * echo "Hello World! I am working!" >> /var/log/cron.log 2>&1 \ No newline at end of file diff --git a/logrotate.sh b/logrotate.sh index 84922ad..aa28ad2 100644 --- a/logrotate.sh +++ b/logrotate.sh @@ -2,7 +2,7 @@ # Create a temporary logrotate configuration file cat < /tmp/logrotate.conf -$LOG_PATH { +"$LOG_PATH" { daily rotate 31 compress @@ -13,8 +13,10 @@ $LOG_PATH { } EOF +cat /tmp/logrotate.conf + # Run logrotate with the temporary configuration file -/usr/sbin/logrotate /tmp/logrotate.conf +/usr/sbin/logrotate --force -d /tmp/logrotate.conf # Clean up the temporary configuration file rm /tmp/logrotate.conf