File size: 792 Bytes
863799a
 
779b72a
863799a
779b72a
863799a
779b72a
 
 
 
 
863799a
779b72a
 
 
 
863799a
779b72a
 
863799a
779b72a
 
 
 
 
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
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  # 设置间隔时间(单位:秒),例如 600 秒(10 分钟)

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.")