Asterisk-phone-reminder/Date-fetching: Unterschied zwischen den Versionen

Aus LaborWiki
Wechseln zu: Navigation, Suche
K (Die Seite wurde neu angelegt: „Automatically fetching dates from the remondis Website: #!/bin/bash YEAR=2010 SRCURL='http://www.remondis.de/index.php?id=4811&streetSearch=1&cityIdent=Boc…“)
 
KKeine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
This is Part of the [[Asterisk-phone-reminder]].
Automatically fetching dates from the remondis Website:
Automatically fetching dates from the remondis Website:



Version vom 13. Januar 2010, 23:13 Uhr

This is Part of the Asterisk-phone-reminder.

Automatically fetching dates from the remondis Website:

 #!/bin/bash
 YEAR=2010
 SRCURL='http://www.remondis.de/index.php?id=4811&streetSearch=1&cityIdent=Bochum&zip=44701&street=Alleestra%C3%9Fe'
 TFILE="/tmp/${RANDOM}_zeug_das_der_muell_parser_hier_liegen_lassen_hat"
 wget -O $TFILE $SRCURL
 DATES=`grep -Eo '[0-9]+\.[0-9]+\.' $TFILE`
 echo "==============================="
 echo -e "Dates found:\n$DATES"
 echo "==============================="
 echo 'Hey you, human! Are the dates all right? Shall I proceed? [y/N] '
 read -n 1 YN
 if [ "$YN" != "Y" ] && [ "$YN" != "y" ] ; then
       exit
 fi
 DDIR="/tmp/$RANDOM"
 mkdir $DDIR
 for i in $DATES ; do
       FNAME=`echo $i | sed -r "s/[^0-9]*([0-9]+)\.([0-9]+)\..*/${YEAR}-\2-\1-gelbersack/"`
       > ${DDIR}/${FNAME}
 done
 echo "Files created in $DDIR. Review & then copy it to /etc/labor-task-reminder/dates"


This little script will download the appropriate Website with the dates for the trash pickup service.