scripts/remind.sh

50 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
TODAY=$(date +"%B %d") #month day
CURRENTYEAR=$(date +%Y)
if grep -q "$TODAY" /home/$USER/scripts/dates.txt; then
NAME=$(grep "$TODAY" /home/meftimes/scripts/dates.txt | awk '{$1=$2=$3=$4=""; print $0}')
BIRTHYEAR=$(grep "$TODAY" /home/meftimes/scripts/dates.txt | awk '{print $4}')
AGE=$(expr $CURRENTYEAR - $BIRTHYEAR)
CATEGORY=$(grep "$TODAY" /home/meftimes/scripts/dates.txt | awk '{print $1}')
REMINDER=$(grep "$TODAY" /home/meftimes/scripts/dates.txt | awk '{$1=$2=$3=""; print $0}')
case $CATEGORY in
"BIRTHDAY" )
curl \
-u :ntfy_token_goes_here \
-H "Priority: urgent" \
-H "Tags: birthday" \
-H "Title: Birthday" \
-d "$NAME is $AGE years old today!" \
https://ntfy_url_goes_here
;;
"RENT" )
curl \
-u :ntfy_token_goes_here \
-H "Priority: urgent" \
-H "Tags: money_with_wings" \
-H "Title: Rent Reminder" \
-d "Payment due!" \
https://ntfy_url_goes_here
;;
"REMINDER" )
curl \
-u :ntfy_token_goes_here \
-H "Priority: urgent" \
2024-03-12 15:35:01 +00:00
-H "Tags: reminder_ribbon" \
-H "Title: Reminder" \
-d "$REMINDER" \
https://ntfy_url_goes_here
;;
esac
else
echo true #do nothing
fi
#absolute path required in script for cronjob to work