From 14a70b571e0dde2bf33b2ccfd0bf07dbad372ea4 Mon Sep 17 00:00:00 2001 From: meftimes Date: Sat, 2 Mar 2024 10:46:52 -0500 Subject: [PATCH] scripts --- birthdays.txt | 3 +++ reminder-birthdays.sh | 21 +++++++++++++++++++++ reminder-rent.sh | 15 +++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 birthdays.txt create mode 100755 reminder-birthdays.sh create mode 100755 reminder-rent.sh diff --git a/birthdays.txt b/birthdays.txt new file mode 100644 index 0000000..f830179 --- /dev/null +++ b/birthdays.txt @@ -0,0 +1,3 @@ +John Doe January 1 2000 +Jane Doe February 1 2000 +Test Test March 2 2020 diff --git a/reminder-birthdays.sh b/reminder-birthdays.sh new file mode 100755 index 0000000..7a25285 --- /dev/null +++ b/reminder-birthdays.sh @@ -0,0 +1,21 @@ +#!/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 new file mode 100755 index 0000000..92b332f --- /dev/null +++ b/reminder-rent.sh @@ -0,0 +1,15 @@ +#!/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