Files
recalbox-savesync/old/slogger[start](permanent).ash
2026-02-28 01:26:44 -06:00

26 lines
495 B
Plaintext

#!/bin/ash
# shellcheck shell=dash
export LOG_FILE="/recalbox/share/system/logs/savesync.log"
export PIPE="/tmp/savesync_pipe"
# Setup the pipe if it doesn't exist
[ -p "$PIPE" ] || mkfifo "$PIPE"
chmod 666 "$PIPE"
write_log() {
printf "[%s] %s\n" "$(date '+%Y-%m-%d %H:%M:%S')" "$1" >>"$LOG_FILE"
}
write_log "--- Logger Started ---"
while true; do
# Read one line from the pipe
if read -r line <"$PIPE"; then
case "$line" in
LOG:*)
write_log "${line#LOG:}"
;;
esac
fi
done