FIFO pipes for speed
This commit is contained in:
22
old/savesync-logger[start](permanent).ash.donotuse
Normal file
22
old/savesync-logger[start](permanent).ash.donotuse
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/ash
|
||||
#shellcheck shell=dash
|
||||
#
|
||||
. /recalbox/share/system/configs/savesync/savesync.conf
|
||||
|
||||
touch "$LOG_FILE"
|
||||
touch "$ERROR_FILE"
|
||||
|
||||
log_to_file() {
|
||||
printf "%s\n" "$1" >>"$LOG_FILE"
|
||||
}
|
||||
|
||||
# Subscribe and wait for log entries
|
||||
mosquitto_sub -h 127.0.0.1 -t "$LOG_TOPIC" | while read -r line; do
|
||||
# The line will look like: SaveLog=[2026-...] [INFO] ...
|
||||
# We strip the "SaveLog=" prefix
|
||||
msg_content="${line#SaveLog=}"
|
||||
|
||||
if [ -n "$msg_content" ]; then
|
||||
log_to_file "$msg_content"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user