diff --git a/packages/bsp/common/etc/cron.weekly/armbian-quotes b/packages/bsp/common/etc/cron.weekly/armbian-quotes new file mode 100755 index 0000000000..f02f01a855 --- /dev/null +++ b/packages/bsp/common/etc/cron.weekly/armbian-quotes @@ -0,0 +1,3 @@ +#!/bin/bash + +curl -s -o "/etc/update-motd.d/quotes.txt" "https://dl.armbian.com/quotes.txt" diff --git a/packages/bsp/common/etc/update-motd.d/35-armbian-tips b/packages/bsp/common/etc/update-motd.d/35-armbian-tips index 3643f97add..0b54c9c3fa 100755 --- a/packages/bsp/common/etc/update-motd.d/35-armbian-tips +++ b/packages/bsp/common/etc/update-motd.d/35-armbian-tips @@ -19,8 +19,12 @@ for f in $MOTD_DISABLE; do done quotes="/etc/update-motd.d/quotes.txt" -if [[ -f $quotes ]]; then +if [[ -f $quotes && $(( $RANDOM % 1 )) == 0 ]]; then random_line=$(shuf -i 1-$(wc -l < $quotes) -n 1) quote=$(sed -n -e "$random_line"p $quotes) - [[ -n $quote ]] && echo -e "\e[93mTip of the day:\e[39m $quote\n" + DUE_DATE=$(echo $quote | cut -d"|" -f1) + SELECTED_QUOTE=$(echo $quote | cut -d"|" -f2) + if [[ -n $SELECTED_QUOTE && $(date +'%Y-%m-%d') < $(date -d $DUE_DATE +"%Y-%m-%d") ]]; then + echo -e "\e[93mTip of the day:\e[39m $SELECTED_QUOTE\n" + fi fi