This script is written to check for tasks that have not been processed for a certain period of time and to trigger an alert when you open the terminal on a Mac.
date -r <target-file-path> +"%s"
↑ You can get the Unix timestamp (epoch seconds) of a file, so use this for calculation.
#!/usr/bin/env zsh
# Alert if a certain amount of time has passed since the last processing
cd "$(dirname $0)" || exit
now=$(date "+%s")
file_timestamp=$(date -r <target-file-path> +"%s")
delta=$(($now - $file_timestamp))
threshold=$((86400 * 35))
# echo "delta = ${delta}"
# echo "threshold = ${threshold}"
if [ ${delta} -gt ${threshold} ]; then
echo "More than 35 days have passed since the last processing."
echo "Please perform the necessary processing."
fi