Update cronjob that creates the 'today' symlink in /data/logs/*

This commit is contained in:
Darren 'Tadgy' Austin 2026-03-30 14:54:16 +00:00
commit 9f1e0b51c8
8 changed files with 32 additions and 65 deletions

View file

@ -0,0 +1,24 @@
#!/bin/bash
# Default configuration.
LOGS_DIR="/data/logs"
# Process the directories in the $LOGS_DIR directory.
[[ -d "$LOGS_DIR" ]] && {
TODAY="$(printf "%(%Y/%m/%d)T")"
for DIR in "$LOGS_DIR"/*/; do
cd "$DIR" 2>/dev/null || {
printf "%s: %s\\n" "${0##*/}" "failed to change directory to '$DIR'" >&2
continue
}
# Create the 'today' symlink to the new location..
ln -sfn "$TODAY" "today" 2>/dev/null || {
printf "%s: %s\\n" "${0##*/}" "updating 'today' symlink failed in '$DIR'" >&2
continue
}
done
}
exit 0