1
0
Fork 0
mirror of https://github.com/kastdeur/dotfiles.git synced 2024-11-17 17:03:32 +01:00
dotfiles/bash/scriptlets/wttr

14 lines
355 B
Text

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