Pig, I made this script to create events with everyday reminders.. It works pretty nice.
The script alerts you in advance around 20 days before event by sending you a mail alert and also a coventional alert .. first days it only alert you each two days, and last seven days It alerts you everyday at 11am.,, If alert is very near It truncates to create only reiterative alerts since the day you set the alert on..
The script set description to title if its empty and set add a code number to end title for deleting the loop of alerts for that coded event.
this way, you can delete easily all alerts associaded to event by using the code number description event:
gcalcli delete <<NumberCodedEvent>>
You can give it a try, Im using it to set reminders
reminder.sh
Code: Select all
#!/bin/bash
#
calen="--calendar=mymail@gmail.com"
read -p "Title: " title
if [ -z "$title" ]
then
echo "título no puede ser null"
exit
fi
read -p "Descripción: " description
if [ -z "$description" ]
then
description="$title"
fi
read -p "When: " choice
if [ -z "$choice" ]
then
echo "fecha de entrada vacia"
exit
fi
NEXT_DATE=$(date +%Y/%m/%d -d "$choice")
#############Codigo bara borrarlas
##>>>>>>>>> gcalcli delete $coddaydel
coddaydel=$(date +%j -d "$choice")
############
title="$title ($coddaydel)"
#description="($coddaydel) $description"
if [ -z "$NEXT_DATE" ]
then
echo "fecha de entrada incorrecta"
exit
fi
#NEXT_DATE=$(date +%d/%m/%Y -d "$NEXT_DATE")
for i in {15..0}
do
NUMERO=$i
let RESTO=NUMERO%2
if [ $RESTO -eq 0 ]; then
echo “El número $NUMERO es par”
else
echo “El número $NUMERO es impar”
if [ $i -gt 6 ]; then
continue
fi
fi
when=$(date +%Y-%m-%d -d "$NEXT_DATE -$i day")
fechahoy=$(date "+%s")
unix_cond=$(date -d "${when}" "+%s")
if [ ${fechahoy} -ge ${unix_cond} ]; then
echo "over condition"
continue
fi
echo "es $when"
gcalcli $calen add --reminder "10m" --reminder "12m email" --description="$description" \
--when="$when at 11am" \
--title="$title" --where="" --duration="600"
done
gcalcli calm
And here the final resulting of setting an alert on 25 Nov.: