diff --git a/birthdays.txt b/birthdays.txt deleted file mode 100644 index 6106c1c..0000000 --- a/birthdays.txt +++ /dev/null @@ -1,2 +0,0 @@ -John Doe January 1 2000 -Jane Doe February 1 2000 \ No newline at end of file diff --git a/dates.txt b/dates.txt new file mode 100644 index 0000000..9d51e87 --- /dev/null +++ b/dates.txt @@ -0,0 +1,4 @@ +BIRTHDAY January 1 2000 John Doe January 1 2000 +BIRTHDAY February 1 2000 Jane Doe +REMINDER March 17 St Patrick's Day +RENT March 29 diff --git a/remind.sh b/remind.sh new file mode 100755 index 0000000..7444aed --- /dev/null +++ b/remind.sh @@ -0,0 +1,49 @@ +#!/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" \ + -H "Tags: reminder" \ + -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 diff --git a/reminder-birthdays.sh b/reminder-birthdays.sh deleted file mode 100755 index 7a25285..0000000 --- a/reminder-birthdays.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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 diff --git a/reminder-rent.sh b/reminder-rent.sh deleted file mode 100755 index 92b332f..0000000 --- a/reminder-rent.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -TODAY=$(date +"%B %d") #month day - -case $TODAY in - "January 29" | "February 26" | "March 29" | "April 28" | "May 29" | "June 28" | "July 29" | "August 29" | "September 28" | "October 29" | "November 28" | "December 29" ) - 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 - ;; -esac