print cached files
This commit is contained in:
parent
ec77e16806
commit
ea8ccba3fa
|
@ -43,12 +43,10 @@ async def block_skylinks_from_airtable():
|
||||||
message = "Siad blocklist endpoint responded with code " + str(response.status_code) + ": " + (response.text or "empty response")
|
message = "Siad blocklist endpoint responded with code " + str(response.status_code) + ": " + (response.text or "empty response")
|
||||||
return await print(message) or send_msg(client, message, force_notify=True)
|
return await print(message) or send_msg(client, message, force_notify=True)
|
||||||
|
|
||||||
print("Clearing nginx cache related to blocked skylinks")
|
print("Purging nginx cache containing blocked skylinks")
|
||||||
find_all_cache_files = '/usr/bin/find /data/nginx/cache/ -type f'
|
purge_command = '/usr/bin/find /data/nginx/cache/ -type f | /usr/bin/xargs --no-run-if-empty -n1000 /bin/grep -El \'^KEY: .*(' + '|'.join(skylinks) + ')\''
|
||||||
grep_pattern = '\'^KEY: .*(' + '|'.join(skylinks) + ')\''
|
cached_files = os.popen('docker exec -it nginx bash -c "' + purge_command + '"').read().strip()
|
||||||
filter_matching_files = '/usr/bin/xargs --no-run-if-empty -n1000 /bin/grep -El ' + grep_pattern
|
print(cached_files)
|
||||||
print('docker exec -it nginx bash -c "' + find_all_cache_files + ' | ' + filter_matching_files + '"')
|
|
||||||
os.popen('docker exec -it nginx bash -c "' + find_all_cache_files + ' | ' + filter_matching_files + '"')
|
|
||||||
|
|
||||||
async def exit_after(delay):
|
async def exit_after(delay):
|
||||||
await asyncio.sleep(delay)
|
await asyncio.sleep(delay)
|
||||||
|
|
Reference in New Issue