frontend/entrypoint.sh
Radical c73fe505a5
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci: fix node path
2025-05-26 23:14:34 +02:00

26 lines
526 B
Bash
Executable file

#!/bin/sh
if [ ! -d "/web/logs" ]; then
mkdir /web/logs
fi
rotate_log() {
LOGFILE="$1"
BASENAME=$(basename "$LOGFILE" .log)
DIRNAME=$(dirname "$LOGFILE")
if [ -f "$LOGFILE" ]; then
# Find the next available number
i=1
while [ -f "$DIRNAME/${BASENAME}.${i}.log.gz" ]; do
i=$((i + 1))
done
gzip "$LOGFILE"
mv "${LOGFILE}.gz" "$DIRNAME/${BASENAME}.${i}.log.gz"
fi
}
rotate_log "/web/logs/frontend.log"
/usr/local/bin/node /web/server/index.mjs 2>&1 | tee /gorb/logs/frontend.log