1
0
Fork 0
mirror of https://github.com/kastdeur/dotfiles.git synced 2024-12-22 17:23:33 +01:00
dotfiles/bash/scriptlets/wttr

15 lines
355 B
Text
Raw Normal View History

WTTR=~/.wttr
if [ -f $WTTR ]; then
cat $WTTR
alias wttr='cat $WTTR'
else
read -p "{$Yel}Do you want your weather cronned? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
cronjob="curl -s wttr.in/Voorthuizen | sec -n 3,7p > $WTTR 2>&1 "
croncmd="27 */2 * * * $cronjob"
( crontab -l | grep -v -F "$croncmd" ; echo "$cronjob" ) | crontab -
fi
fi