Wetterbericht

cooles teil! geladen und probiert. funktioniert.
ganz heiss is das ding natürlich, wenn man dies über cron so ausführt, das die motd jedesmal aktualisiert wird :D
 
lud% sh weather.sh
date: unknown option -- v
usage: date [-nu] [-r seconds] [+format]
date [[[[[cc]yy]mm]dd]hh]mm[.ss]
date: unknown option -- v
usage: date [-nu] [-r seconds] [+format]
date [[[[[cc]yy]mm]dd]hh]mm[.ss]
date: unknown option -- v
usage: date [-nu] [-r seconds] [+format]
date [[[[[cc]yy]mm]dd]hh]mm[.ss]
date: unknown option -- v
usage: date [-nu] [-r seconds] [+format]
date [[[[[cc]yy]mm]dd]hh]mm[.ss]
fetch: not found

System: NetBSD 2.02

das date kennt kein -v und fetch existiert weder aufm system noch im pkgsrc
 
Ich habs noch nicht ausprobiert: Bietet yahoo auch Deutschland-Wetter? Unter der URL im Script finde ich nur US-Städte...
 
Müsste es im script in der Funktion Get_Curcon() nicht
Code:
	low=`cat $tmp_file | head -n $end | tail -n $diff | grep "Low" |
		awk -F \< '{[B]print $12[/B]}' | sed 's/[^0-9,-]//g'`
statt
Code:
	low=`cat $tmp_file | head -n $end | tail -n $diff | grep "Low" |
		awk -F \< '{[B]print $11[/B]}' | sed 's/[^0-9,-]//g'`
heissen ? Andernfalls wird bei mir nicht der korrekte Wert für "Low" angezeigt (verglichen mit der Anzeige auf der Webseite weather.yahoo.com)
 
bsc schrieb:
Müsste es im script in der Funktion Get_Curcon() nicht
Code:
	low=`cat $tmp_file | head -n $end | tail -n $diff | grep "Low" |
		awk -F \< '{[B]print $12[/B]}' | sed 's/[^0-9,-]//g'`
statt
Code:
	low=`cat $tmp_file | head -n $end | tail -n $diff | grep "Low" |
		awk -F \< '{[B]print $11[/B]}' | sed 's/[^0-9,-]//g'`
heissen ? Andernfalls wird bei mir nicht der korrekte Wert für "Low" angezeigt (verglichen mit der Anzeige auf der Webseite weather.yahoo.com)

Ja, natürlich. Danke!

Freue mich über die Resonanz. Ich werde die korrigierte Version uploaden.

-MadMax
 
RvG schrieb:
System: NetBSD 2.02

das date kennt kein -v und fetch existiert weder aufm system noch im pkgsrc

Sorry! Ist auf FreeBSD erstellt.

fetch --> müsste sich ohne viel arbeit durch wget ersetzen lassen
date --> vielleicht bietet NetBSD eine andere Option für date

-MadMax
 
Aus:
fetch -o $tmp_file -q ${url}/${location_code}_c.html?force_units=1 > \

wird:
wget -O $tmp_file -q ${url}/${location_code}_c.html?force_units=1 > \


Aus:
today_1=`date -v +1d | awk '{print $1}'`
today_2=`date -v +2d | awk '{print $1}'`
today_3=`date -v +3d | awk '{print $1}'`
today_4=`date -v +4d | awk '{print $1}'`

wird:
today=`date | awk {'print $1'}`
if [ $today = "Mon" ] ; then today_1=Tue today_2=Wed today_3=Thu today_4=Fri ; fi
if [ $today = "Tue" ] ; then today_1=Wed today_2=Thu today_3=Fri today_4=Sat ; fi
if [ $today = "Wed" ] ; then today_1=Thu today_2=Fri today_3=Sat today_4=Sun ; fi
if [ $today = "Thu" ] ; then today_1=Fri today_2=Sat today_3=Sun today_4=Mon ; fi
if [ $today = "Fri" ] ; then today_1=Sat today_2=Sun today_3=Mon today_4=Tue ; fi
if [ $today = "Sat" ] ; then today_1=Sun today_2=Mon today_3=Tue today_4=Wed ; fi
if [ $today = "Sun" ] ; then today_1=Mon today_2=Tue today_3=Wed today_4=Thu ; fi
 
hui, cool, man kann das Skript auch in die eigene .login.conf stecken und man bekommt beim Login immer das aktuelle Wetter :)
 
marzl schrieb:
hui, cool, man kann das Skript auch in die eigene .login.conf stecken und man bekommt beim Login immer das aktuelle Wetter :)

Habe ich mir gestern bereits angetan, und das mit der .login.conf ist IMHO der richtige Ort, da jeder Benutzer seine eigene Location eintragen kann.

*daumenhoch* für dieses Script.

Greets, s_e
 
hui, cool, man kann das Skript auch in die eigene .login.conf stecken und man bekommt beim Login immer das aktuelle Wetter
Das könnte sich wohl zur neuen Definition eines geeks/nerds durchsetzen....
Wetterdaten im Login angucken, statt ausm Fenster zu schauen...
 
Seit geraumer Zeit benimmt sich das Script ein Wenig sonderbar:

Code:
expr: syntax error
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
expr: syntax error
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
expr: syntax error
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
expr: syntax error
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
expr: syntax error
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
head: option requires an argument -- n
usage: head [-n lines | -c bytes] [file ...]
tail: option requires an argument -- n
usage: tail [-F | -f | -r] [-q] [-b # | -c # | -n #] [file ...]
Weather conditions and forecast for .
Last report update at:

Today:   High: na dC   Low: na dC    Temp: na dC
         Feels Like: na dC    Sky: na
         Pressure: na mb      Humidity: na %
         Dewpoint: na dC      Wind: na kph
         Sunrise: na am       Sunset: na pm

Sat:     High: na dC   Low: na dC    Sky: na
Sun:     High: na dC   Low: na dC    Sky: na
Mon:     High: na dC   Low: na dC    Sky: na
Tue:     High: na dC   Low: na dC    Sky: na

Verwendetes System:
Code:
FreeBSD HAM.annen.netz 6.1-STABLE FreeBSD 6.1-STABLE #1: Mon Jul 17 21:14:31 CEST 2006     root@HAM.annen.netz:/usr/obj/usr/src/sys/GENERIC  i386

Leider bin ich nicht der Scriptexperte, könnte mir mal jemand auf die Sprünge helfen?

Besten Dank und Gruss, s_e
 
Danke für den Hinweis.

Der Fehler liegt wahrscheinlich daran, dass sich etwas an der yahoo seite gändert hat. Ich werde versuchen, den Fehler zu beheben.

Bis dahin
-MadMax
 
So, wie schon vermutet, hat sich wieder mal der Lehrling bei yahoo in html geübt.

Das Script funktioniert wieder und hat gleichzeitig 2 neue command line options dazu bekommen. Die Optionen "cc" und "fc" zeigen dann nur die current conditions bzw. forecast conditions an. Ohne Optionen antwortet das Script wie gewohnt.

http://www.tu-chemnitz.de/~stthu/files/weather.sh

Viel Spass
-MadMax

ps: und nicht vergessen den eigenen Location Code einzutragen
 
Da im Moment der Wetterservice bei yahoo etwas wackelig ist, habe ich das Script etwas robuster im Umgang mit Fehlern gemacht.

Die neue Version liegt an bekannter Stelle.

Gruesse
-MadMax
 
elenio@desktop:~$ sh weather.sh
date: Ungültige Option -- v
»date --help« gibt weitere Informationen.
date: Ungültige Option -- v
»date --help« gibt weitere Informationen.
date: Ungültige Option -- v
»date --help« gibt weitere Informationen.
date: Ungültige Option -- v
»date --help« gibt weitere Informationen.
Couldn't get weather data.

Linux desktop 2.4.27-2-386 #1 Wed Nov 30 21:38:51 JST 2005 i686 GNU/Linux (debian sage):confused:

meint ihr,es ist ohne großartigen aufwand moeglich, dass ding auf linux zum laufen zu bekommen?!

byebye
 
dieGo schrieb:
Linux desktop 2.4.27-2-386 #1 Wed Nov 30 21:38:51 JST 2005 i686 GNU/Linux (debian sage):confused:

meint ihr,es ist ohne großartigen aufwand moeglich, dass ding auf linux zum laufen zu bekommen?!

byebye

Ja, ist nicht schwer. Schau mal die etwas früheren postings in diesem Beitrag an. Da ist das schon mal für NetBSD angepasst worden.

Falls du es selbst nicht schaffst, sag noch mal bescheid, evtl. werde ich dann das Script anpassen.

Grüße
-MadMax
 
Langsam wirds nervig mit yahoo. Scheinbar basteln die immer noch an der Seite. Deshalb musste ich schon wieder eine korrigierte Version bereitstellen. Mal sehen wie es weiter geht. Falls die Seite nicht stabil wird, muss ich mich nach anderen Quellen für die Wetterdaten umsehen.

Eine Linux version liegt auch bereit (getestet unter Scientific Linux SL release 4.3 (Beryllium)).

http://www.tu-chemnitz.de/~stthu/files/weather.sh
http://www.tu-chemnitz.de/~stthu/files/linux-weather.sh

Grüße
-MadMax
 
Zurück
Oben