Skip to content

Commit

Permalink
Signal traefik process to rotate logs
Browse files Browse the repository at this point in the history
  • Loading branch information
CannonLock committed Sep 30, 2024
1 parent f79dc33 commit 5b48e34
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ if [ -f "$ROTATED_LOG_FILE" ]; then
echo "Log rotation successful. Processing the rotated log file."
# Call the import script
python3 /app/import_logs.py --dry-run "$ROTATED_LOG_FILE" --url "$MATOMO_URL" --token-auth "$API_TOKEN"

# Find the PID of the traefik process
TRAEFIK_PID=$(pgrep traefik)

# Check if the PID was found
if [ -n "$TRAEFIK_PID" ]; then
# Send USR1 signal to the traefik process
kill -USR1 "$TRAEFIK_PID"
echo "Sent USR1 signal to traefik process with PID $TRAEFIK_PID"
else
echo "Traefik process not found."
exit 1
fi
else
echo "Rotated log file not found."
exit 1
Expand Down

0 comments on commit 5b48e34

Please sign in to comment.