|
import time |
|
|
|
def read_and_print_file(): |
|
try: |
|
with open('/etc/searxng/settings.yml', 'r') as file: |
|
content = file.read() |
|
print("File Content:\n", content) |
|
except FileNotFoundError: |
|
print("Error: File '/etc/searxng/settings.yml' not found.") |
|
except PermissionError: |
|
print("Error: Permission denied to read the file.") |
|
except Exception as e: |
|
print(f"An unexpected error occurred: {e}") |
|
|
|
|
|
interval = 600 |
|
|
|
print("Starting task. Press Ctrl+C to stop.") |
|
try: |
|
while True: |
|
read_and_print_file() |
|
print(f"Sleeping for {interval} seconds...") |
|
time.sleep(interval) |
|
except KeyboardInterrupt: |
|
print("\nTask stopped.") |