49 lines
1.1 KiB
Bash
Executable File
49 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
DATES_FILE="/home/meftimes/scripts/dates.txt"
|
|
NTFY_TOKEN="token_goes_here"
|
|
|
|
TODAY=$(date +"%B %d") #works
|
|
|
|
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 ))
|
|
|
|
TAGS="birthday"
|
|
TITLE="Birthday"
|
|
CONTENT="$NAME is $AGE years old today!"
|
|
;;
|
|
|
|
"RENT" )
|
|
TAGS="money_with_wings"
|
|
TITLE="Rent Reminder"
|
|
CONTENT="Payment due!"
|
|
;;
|
|
|
|
"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
|