commit
92b9f3a195
2 changed files with 10 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
### Default values
|
### Default values
|
||||||
scriptVersion="1.4"
|
scriptVersion="1.5"
|
||||||
scriptName="ARLChecker"
|
scriptName="ARLChecker"
|
||||||
sleepInterval='24h'
|
sleepInterval='24h'
|
||||||
### Import Settings
|
### Import Settings
|
||||||
|
|
|
@ -3,7 +3,7 @@ from pathlib import Path
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from requests import Session
|
from requests import Session
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from sys import argv
|
from sys import argv, stdout
|
||||||
from colorama import Fore, init
|
from colorama import Fore, init
|
||||||
from telegram import Update
|
from telegram import Update
|
||||||
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
|
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
|
||||||
|
@ -17,12 +17,19 @@ with open("/custom-services.d/ARLChecker", "r") as r:
|
||||||
if 'scriptVersion' in line:
|
if 'scriptVersion' in line:
|
||||||
VERSION = re.search(r'"([A-Za-z0-9_\./\\-]*)"', line)[0].replace('"','')
|
VERSION = re.search(r'"([A-Za-z0-9_\./\\-]*)"', line)[0].replace('"','')
|
||||||
|
|
||||||
|
# Get current log file
|
||||||
|
path = '/config/logs'
|
||||||
|
latest_file = max([os.path.join(path, f) for f in os.listdir(path) if 'ARLChecker' in f],key=os.path.getctime)
|
||||||
|
|
||||||
# Logging Setup
|
# Logging Setup
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
format=f'%(asctime)s :: ARLChecker :: {VERSION} :: %(levelname)s :: %(message)s',
|
format=f'%(asctime)s :: ARLChecker :: {VERSION} :: %(levelname)s :: %(message)s',
|
||||||
datefmt='%Y-%m-%d %H:%M:%S',
|
datefmt='%Y-%m-%d %H:%M:%S',
|
||||||
level=logging.INFO
|
level=logging.INFO,
|
||||||
|
handlers=[
|
||||||
|
logging.StreamHandler(stdout),
|
||||||
|
logging.FileHandler(latest_file, mode="a")
|
||||||
|
]
|
||||||
)
|
)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue