Rename work 🏗
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
A plugin responsible for general maintenance tasks. These currently include:
|
||||
|
||||
- pialert.log cleanup
|
||||
- app.log cleanup
|
||||
|
||||
### Usage
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
{
|
||||
"function": "CMD",
|
||||
"type": "readonly",
|
||||
"default_value": "python3 /home/pi/pialert/front/plugins/maintenance/maintenance.py",
|
||||
"default_value": "python3 /app/front/plugins/maintenance/maintenance.py",
|
||||
"options": [],
|
||||
"localized": ["name", "description"],
|
||||
"name": [
|
||||
@@ -164,7 +164,7 @@
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "How many last <code>pialert.log</code> lines to keep. If <code>LOG_LEVEL</code> is set to <code>debug</code> the app generates about 10000 lines per hour, so when debugging an issue the recommended setting should cover the bug occurence timeframe. For example for a bug with a 3 day periodical appearence the value <code>1000000</code> should be sufficient. Setting this value to <code>1000000</code> generates approximatelly a 50MB <code>pialert.log</code> file. Set to <code>0</code> to disable log purging."
|
||||
"string" : "How many last <code>app.log</code> lines to keep. If <code>LOG_LEVEL</code> is set to <code>debug</code> the app generates about 10000 lines per hour, so when debugging an issue the recommended setting should cover the bug occurence timeframe. For example for a bug with a 3 day periodical appearence the value <code>1000000</code> should be sufficient. Setting this value to <code>1000000</code> generates approximatelly a 50MB <code>app.log</code> file. Set to <code>0</code> to disable log purging."
|
||||
}]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -11,9 +11,10 @@ from io import StringIO
|
||||
from datetime import datetime
|
||||
from collections import deque
|
||||
|
||||
sys.path.extend(["/home/pi/pialert/front/plugins", "/home/pi/pialert/netalertx"])
|
||||
# Register NetAlertX directories
|
||||
INSTALL_PATH="/app"
|
||||
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
||||
|
||||
# Register NetAlertX modules NetAlertX directories
|
||||
from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
|
||||
from logger import mylog, append_line_to_file
|
||||
from helper import timeNowTZ, get_setting_value
|
||||
@@ -37,7 +38,7 @@ def main():
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] Cleaning file'])
|
||||
|
||||
logFile = logPath + "/pialert.log"
|
||||
logFile = logPath + "/app.log"
|
||||
|
||||
# Using a deque to efficiently keep the last N lines
|
||||
lines_to_keep = deque(maxlen=MAINT_LOG_LENGTH)
|
||||
|
||||
Reference in New Issue
Block a user