announcement-box/bin/schedule_meeting

27 lines
494 B
Plaintext
Raw Permalink Normal View History

#!/bin/bash
function time_minus_minutes() {
time="$1"
change="$2"
difference=$(($change * 60))
result=$(( $(date -d "$time" "+%s") - $difference ))
echo `date -d "@$result" "+%H:%M"`
}
TYPE=$1
shift
TARGET=$1
shift
SLACK=5
TIME=`time_minus_minutes "$TARGET" "$SLACK"`
NAME="$@"
MSG="Meeting in $SLACK minutes. ... Meeting '$NAME' in $SLACK minutes."
#echo "Scheduling $TYPE for meeting '$NAME' at $TARGET in $SLACK minutes in advance, at $TIME."
~/schedule_${TYPE} "$TIME" "$MSG"