[feature] 更新log相关
This commit is contained in:
parent
fc676746cf
commit
069d5119c3
|
@ -52,7 +52,7 @@ class CommandProcessor:
|
|||
# cp.Command("command")
|
||||
# cp.RetryCommand("command",retry_time:int)
|
||||
# asyncio.run(cp.AsyncCommand("command","stop track regex"))
|
||||
script_dir = os.path.dirname((os.path.abspath(__file__)))
|
||||
# script_dir = os.path.dirname((os.path.abspath(__file__)))
|
||||
cp = CommandProcessor()
|
||||
haveError = False
|
||||
def TaskFailRetry(command:str)->int:
|
||||
|
@ -75,6 +75,7 @@ cp.Command("maa self update")
|
|||
cp.Command("docker stop redroid")
|
||||
redroid_path = os.getenv('redroid_path', "/home/lichx/.config/redroid-rk3588/")
|
||||
adb_address = os.getenv('adb_address', "localhost:5555")
|
||||
log_dir = os.getenv('MAA_LOG', "/home/lichx/.config/redroid-rk3588/log/")
|
||||
os.chdir(redroid_path)
|
||||
cp.Command("docker compose up -d")
|
||||
time.sleep(15)
|
||||
|
@ -89,7 +90,7 @@ haveError |= TaskFailRetry("maa run mall") != 0
|
|||
haveError |= TaskFailRetry("maa run award") != 0
|
||||
# storage error log
|
||||
if haveError:
|
||||
cp.Command(f"cp {script_dir}/pyshell.log {script_dir}/pyshell.{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}.log")
|
||||
cp.Command(f"cp {log_dir}/pyshell.log {log_dir}/pyshell.{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}.log")
|
||||
# shutdown
|
||||
cp.RetryCommand("maa closedown")
|
||||
cp.Command("docker stop redroid")
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||
MAA_PY="$SCRIPT_DIR/ArknightsMaaConfig/maa.py"
|
||||
MAA_LOG_DIR="${MAA_LOG:-/var/log/maa.log}"
|
||||
|
||||
if [ -x "$MAA_PY" ]; then
|
||||
"$MAA_PY"
|
||||
"$MAA_PY" > "$MAA_LOG_DIR" 2>&1
|
||||
else
|
||||
python3 "$MAA_PY"
|
||||
python3 "$MAA_PY" > "$MAA_LOG_DIR" 2>&1
|
||||
fi
|
Loading…
Reference in New Issue