diff --git a/inspector/README.md b/inspector/README.md index 325c3fd..c989d49 100644 --- a/inspector/README.md +++ b/inspector/README.md @@ -61,11 +61,11 @@ When done your folders structure should look like this: `/home/[username]/script ## Script -Get the source code from this repo and save it as `inspector.py` in the **inspector** folder created in the previous step. +Get the source code from this repo and save it as `inspector_qbitt.py` in the **inspector** folder created in the previous step. Next we need to change the permissions of this file so that the server can read it. -1. Right click on `inspector.py` then Properties. +1. Right click on `inspector_qbitt.py` then Properties. 2. Click on `Permissions` tab at top. @@ -79,12 +79,12 @@ Next we need to change the permissions of this file so that the server can read Now we need to test and run the script. -Make sure your terminal is open to the location of the `inspector.py` file. Should be `~/scripts/inspector` +Make sure your terminal is open to the location of the `inspector_qbitt.py` file. Should be `~/scripts/inspector` -Normally to run a Python script will would use `python3 inspector.py` +Normally to run a Python script will would use `python3 inspector_qbitt.py` This will still work but because we have shebang set in the script we can just use -`./inspector.py` +`./inspector_qbitt.py` You should now see `[INFO]` log with the status of the **qbittorrent** container. In the script we set the run time with `interval_seconds = 60`. This setting tells the script to check the health of the container every minute. diff --git a/inspector/inspector.py b/inspector/inspector.py index 7a148b7..54920e2 100755 --- a/inspector/inspector.py +++ b/inspector/inspector.py @@ -13,7 +13,7 @@ import requests container_name = 'qbittorrent' interval_seconds = 60 -logs_folder = 'logs/qbittorrent' +logs_folder = 'logs/inspector_qbitt' cooldown_seconds = 300 max_error_count = 5 @@ -22,13 +22,13 @@ if not os.path.exists(logs_folder): os.makedirs(logs_folder) def get_log_file_path(): - return os.path.join(logs_folder, 'qbittorrent.log') + return os.path.join(logs_folder, 'inspector_qbitt.log') def rotate_log_files(log_file): now = datetime.datetime.now() timestamp = now.strftime('%Y-%m-%d') rotated_log_file = f'{timestamp}.log' - rotated_log_file = f'qbittorrent_{timestamp}.log' + rotated_log_file = f'inspector_qbitt_{timestamp}.log' rotated_log_path = os.path.join(logs_folder, rotated_log_file) # Rename the current log file to the rotated log file