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…“)
 
K (year selection depending on date)
 
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
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:


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

Aktuelle Version vom 5. November 2010, 10:50 Uhr

This is Part of the Asterisk-phone-reminder.

Automatically fetching dates from the remondis Website:

#!/bin/bash
YEAR=`date '+%Y'`
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.