frontend/entrypoint.sh
Radical dc3fd58c72
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
ci: add ci and docker files
2025-05-05 13:11:07 +02:00

26 lines
520 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/bin/node /web/server/index.mjs 2>&1 | tee /gorb/logs/frontend.log