From 1762c7f7b7b9bbf984746e71b6b612c10d4905f9 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Fri, 5 Mar 2021 23:37:27 +0100 Subject: [PATCH] fixed writing to file --- setup-scripts/blocklist-airtable.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setup-scripts/blocklist-airtable.py b/setup-scripts/blocklist-airtable.py index 14544b18..8d5e2de3 100755 --- a/setup-scripts/blocklist-airtable.py +++ b/setup-scripts/blocklist-airtable.py @@ -76,9 +76,8 @@ async def block_skylinks_from_airtable(): print("Searching nginx cache for blocked files") - f = open("/tmp/blocklist-aritable.txt", "w") - f.write("^KEY: .*" + "^KEY: .*\n".join(skylinks)) - f.close() + print("Searching nginx cache for blocked files") + exec('printf "^KEY: .*' + '\n^KEY: .*'.join(skylinks) + '" > /tmp/blocklist-aritable.txt') cached_files_command = ( "/usr/bin/find /data/nginx/cache/ -type f | /usr/bin/xargs --no-run-if-empty -n1000 /bin/grep -Els --file /tmp/blocklist-aritable.txt" )