Проверка скидки выходного дня на labirint.ru

До конца 2012 года в магазине labirint.ru каждый месяц устраивается акция: в один из выходных они на все товары дают скидку в 3 процента.

Вот скриптик для того чтобы автоматизировать проверку наличия скидки и не проверять руками каждый выходной.
#!/bin/bash

#список почтовых адресатов для рассылки сообщения о скидке (через пробел)
MAILERS="john@example.com mary@example.com"

logo_img=$(wget -q http://www.labirint.ru -O - \
 | iconv -f cp1251 -t utf8 \
 | grep -A 2 "id=\"logo\"" \
 | xpath -e '//img[@src]/@src[1]' 2>/dev/null \
 |  sed -E -e "s/ src=\"(.+)\"/\\1/")

if [ $logo_img == "http://img.labirint.ru/design/logo_we.png" ]; then
  mail -s "Скидка в лабиринте" $MAILERS <<-EOF
 Weekend discount at http://www.labirint.ru
EOF
fi

Добавляем этот скрипт на выполнение в крон:
0 6 * * 6 $HOME/bin/labirint_discount_check.sh
и ждем писем счастья :)

P.S. для корретной работы нужны пакеты wget и libxml-xpath-perl

1 комментарий:

  1. You're not risking any cash, so take your time to follow lengthy as|for so long as} you please. Most video poker gamers are unaware of means to|tips on how to} use the management provided to their advantage. Instead, they plop down on any nearby video poker machine and play by guesses hoping to get fortunate. This implies that for every €100 로스트아크 spent on 5 credit score bets, your anticipated return is roughly €99.fifty four and for one to four credit score bets, it's €98.18.

    ОтветитьУдалить