1
0
Fork 0
mirror of https://github.com/kastdeur/dotfiles.git synced 2024-11-14 15:43:31 +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