Use timestamp for naming logfiles

This commit is contained in:
Sayantan Santra 2023-04-23 18:28:58 -05:00
parent a7ac30a676
commit 16c25d7460

View file

@ -3,13 +3,13 @@
# Run only one instance of this script at one time # Run only one instance of this script at one time
[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/revanced-builder.lock" "$0" "$@" || : [ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/revanced-builder.lock" "$0" "$@" || :
# Log everything to a logfile inside logs/
log_file="$1/logs/$(date '+%s')"
[ -d "$1" ] && mkdir -p "$1/logs" && exec > >(tee "$log_file") 2>&1
# Get timestamp # Get timestamp
timestamp=$(date '+%s') timestamp=$(date '+%s')
# Log everything to a logfile inside logs/
log_file="$1/logs/$timestamp"
[ -d "$1" ] && mkdir -p "$1/logs" && exec > >(tee "$log_file") 2>&1
# Set working directory and current directory # Set working directory and current directory
if [ -d "$1" ]; then if [ -d "$1" ]; then
WDIR="$1" WDIR="$1"