-
Notifications
You must be signed in to change notification settings - Fork 6
/
cache_purge.sh
executable file
·27 lines (23 loc) · 1.01 KB
/
cache_purge.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
SCRIPT=$MW_HOME/maintenance/purgePage.php
logfileName=cache_purge_log
echo "Starting cache purge (in 60 seconds)..."
# Wait 10 seconds after the server starts up to give other processes time to get started
sleep 60
echo "Cache purger started"
while true; do
logFilePrev="$logfileNow"
logfileNow="$MW_LOG/$logfileName"_$(date +%Y%m%d)
if [ -n "$logFilePrev" ] && [ "$logFilePrev" != "$logfileNow" ]; then
/rotatelogs-compress.sh "$logfileNow" "$logFilePrev" &
fi
date >> "$logfileNow"
# Purge the page
printf "$MW_CACHE_PURGE_PAGE" | php "$SCRIPT" >> "$logfileNow"
# Fetch the page to warm up the caches
#### Disabled, Varnish does this itself in sub vcl_purge, see MBSD-103 ####
# curl -I -XGET "http://localhost:8081/$MW_CACHE_PURGE_PAGE" >> "$logfileNow"
# Wait some seconds to let the CPU do other things, like handling web requests, etc
echo cache_purge_log waits for "$MW_CACHE_PURGE_PAUSE" seconds... >> "$logfileNow"
sleep "$MW_CACHE_PURGE_PAUSE"
done