22 lines
615 B
Bash
Executable File
22 lines
615 B
Bash
Executable File
#!/bin/bash
|
|
|
|
TODAY=$(date +"%B %d") #month day
|
|
CURRENTYEAR=$(date +%Y)
|
|
|
|
if grep -q "$TODAY" /home/$USER/scripts/birthdays.txt; then
|
|
NAME=$(grep "$TODAY" /home/$USER/scripts/birthdays.txt | awk '{print $1,$2}')
|
|
BIRTHYEAR=$(grep "$TODAY" /home/$USER/scripts/birthdays.txt | awk '{print $5}')
|
|
AGE=$(expr $CURRENTYEAR - $BIRTHYEAR)
|
|
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
|
|
else
|
|
echo true #do nothing
|
|
fi
|
|
|
|
#absolute path required in script for cronjob to work
|