Add countdown/newyeard support to all cronjobs. - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit bd27303540f31dfdc4a549513db01ec95c012294 DIR parent c0057dc11ffb38e29ac6bd63691f02cf5d40c39e HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Sun, 26 Feb 2023 18:48:53 +0100 Add countdown/newyeard support to all cronjobs. Diffstat: M chinese-newyear-cronjob | 2 ++ A countdownd | 14 ++++++++++++++ M ed-cronjob | 2 ++ M groundhog-cronjob | 2 ++ M newyear-cronjob | 2 ++ M rs-232-cronjob | 2 ++ 6 files changed, 24 insertions(+), 0 deletions(-) --- DIR diff --git a/chinese-newyear-cronjob b/chinese-newyear-cronjob @@ -8,6 +8,8 @@ curdate="$(LANG=C date -I)" if [ "${curdate}" = "${cnyprior}" ]; then annna-say -s "irc.bitreich.org" -c "#bitreich-en" "One day until Chinese New Year!" + + countdownd "$(date -d "+ 1 day" -I)" "#bitreich-en" "Chinese New Year" fi if [ "${curdate}" = "${chinesenewyear}" ]; DIR diff --git a/countdownd b/countdownd @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ $# -lt 3 ]; +then + printf "usage: %s YYYY-MM-DD irc-channel description\n" "$(basename "$0")" >&2 + exit 1 +fi + +exe="/home/20h/scm/newyeard/newyeard.py" + +{ + $exe -c "$2" -d "$3" "$1" & +} & + DIR diff --git a/ed-cronjob b/ed-cronjob @@ -7,6 +7,8 @@ curdate="$( (echo obase=16; date +%j) | bc )" if [ "${curdate}" = "EC" ]; then annna-say -c "#bitreich-en" "One day until ED day! gophers://bitreich.org/1/ed" + + countdownd $(date -d "+ 1 day" -I) "#bitreich-en" "ED day" fi if [ "${curdate}" = "ED" ]; DIR diff --git a/groundhog-cronjob b/groundhog-cronjob @@ -7,6 +7,8 @@ curdate="$(LANG=C date -I | cut -d- -f 2-)" if [ "${curdate}" = "02-01" ]; then annna-say -s "irc.libera.chat" -c "#gopherproject" "One day until Groundhog Day! gophers://bitreich.org/1/groundhog-day" + + countdownd $(date -d "+ 1 day" -I) "irc.libera.chat/#gopherproject" "Groundhog Day" fi if [ "${curdate}" = "02-02" ]; DIR diff --git a/newyear-cronjob b/newyear-cronjob @@ -7,6 +7,8 @@ curdate="$(LANG=C date -I | cut -d- -f 2-)" if [ "${curdate}" = "12-31" ]; then annna-say -s "irc.bitreich.org" -c "#bitreich-en" "One day until New Year!" + + countdownd $(date -d "+ 1 day" -I) "#bitreich-en" "New Year" fi if [ "${curdate}" = "01-01" ]; DIR diff --git a/rs-232-cronjob b/rs-232-cronjob @@ -7,6 +7,8 @@ curdate="$( date +%j )" if [ "${curdate}" = "231" ]; then annna-say -c "#bitreich-en" "One day until RS-232 day! gopher://gopherpedia.com/0/RS-232" + + countdownd $(date -d "+ 1 day" -I) "#bitreich-en" "RS-232 Day" fi if [ "${curdate}" = "232" ];