scripts/remind.sh

49 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
2024-11-04 01:24:16 +00:00
DATES_FILE="/home/meftimes/scripts/dates.txt"
NTFY_TOKEN="token_goes_here"
2024-11-04 01:24:16 +00:00
TODAY=$(date +"%B %d") #works
2024-11-04 01:24:16 +00:00
grep "$TODAY" $DATES_FILE | while read -r LINE; do
CATEGORY=$(echo "$LINE" | awk '{print $1}')
case $CATEGORY in
"BIRTHDAY" )
CURRENTYEAR=$(date +%Y)
NAME=$(echo "$LINE" | awk '{$1=$2=$3=$4=""; print $0}' )
BIRTHYEAR=$(echo "$LINE" | awk '{print $4}')
AGE=$(( CURRENTYEAR - BIRTHYEAR ))
2024-11-04 01:24:16 +00:00
TAGS="birthday"
TITLE="Birthday"
CONTENT="$NAME is $AGE years old today!"
;;
2024-11-04 01:24:16 +00:00
"RENT" )
TAGS="money_with_wings"
TITLE="Rent Reminder"
CONTENT="Payment due!"
;;
2024-11-04 01:24:16 +00:00
"REMINDER" )
REMINDER=$(echo "$LINE" | awk '{$1=$2=$3=""; print $0}')
TAGS="reminder_ribbon"
TITLE="Reminder"
CONTENT="$REMINDER"
;;
*)
TAGS=""
TITLE="Unknown category"
CONTENT="..."
esac
curl \
-u :$NTFY_TOKEN \
-H "Priority: urgent" \
-H "Tags: $TAGS" \
-H "Title: $TITLE" \
-d "$CONTENT" \
https://ntfy.meftimes.com/alerts
done