linux - fix scheduler logs

This commit is contained in:
fl0ppy-d1sk 2024-09-13 17:11:31 +02:00
parent 29a2582f4b
commit 274c1260d9
4 changed files with 11 additions and 1 deletions

View file

@ -2,7 +2,10 @@
## v1.5.10 - ????/??/??
- [UI] Fix setup wizard bug related to certificate
- [UI] Fix bug when adding more than 3 reverse proxies URLs
- [BUGFIX] Add HTTP3 specific modsec rule in web UI to avoid false positives
- [BUGFIX] Fix missing scheduler logs in Linux integration
- [DEPS] Updated NGINX version to v1.26.2
- [DEPS] Updated LuaJIT version to v2.1-20240815
- [DEPS] Updated libmaxminddb version to v1.11.0

View file

@ -10,7 +10,7 @@ PIDFile=/var/run/bunkerweb/scheduler.pid
ExecStart=/usr/share/bunkerweb/scripts/start.sh start
ExecStop=/usr/share/bunkerweb/scripts/start.sh stop
ExecReload=/usr/share/bunkerweb/scripts/start.sh reload
Type=simple
Type=exec
StandardOutput=journal+console
StandardError=journal+console

View file

@ -215,6 +215,7 @@ function start() {
# Execute scheduler
log "SYSTEMCTL" " " "Executing scheduler ..."
export LOG_TO_FILE=yes
sudo -E -u nginx -g nginx /bin/bash -c "PYTHONPATH=/usr/share/bunkerweb/deps/python/ /usr/share/bunkerweb/scheduler/main.py --variables /etc/bunkerweb/variables.env"
# shellcheck disable=SC2181
if [ $? -ne 0 ] ; then

View file

@ -6,6 +6,7 @@ from datetime import datetime
from io import BytesIO
from itertools import chain
from json import load as json_load
from logging import FileHandler
from os import _exit, environ, getenv, getpid, sep
from os.path import join
from pathlib import Path
@ -78,6 +79,11 @@ SCHEDULER_TMP_ENV_PATH.touch()
DB_LOCK_FILE = Path(sep, "var", "lib", "bunkerweb", "db.lock")
logger = setup_logger("Scheduler", getenv("LOG_LEVEL", "INFO"))
if environ.get("LOG_TO_FILE", "no") == "yes":
file_handler = FileHandler("/var/log/bunkerweb/scheduler.log")
file_handler.setFormatter("%(asctime)s [%(name)s] [%(process)d] [%(levelname)s] - %(message)s")
logger.addHandler(file_handler)
SLAVE_MODE = environ.get("SLAVE_MODE", "no") == "yes"
MASTER_MODE = environ.get("MASTER_MODE", "no") == "yes"