[Eisfair] Probleme mit PNG-Erzeugung / libssl???

Stefan Heidrich stefan-in-news at web.de
Do Apr 17 13:01:19 CEST 2014


Hallo Marcus,

> Wenn das Script nicht zu lang, poste es doch mal; oder per PM.

sorry, war ein paar Tage unterwegs.
Anbei das Script; die 4 Änderungen sind markiert.

Viele Grüße
Stefan

~~~~

#!/bin/sh
#----------------------------------------------------------------------------
# /usr/local/bin/eiswetterstation.sh  - Shell-script for EisWetterstation
#
# Erstellt:     06.04.2008  Stefan Heidrich
# Geaendert:    10.04.2014  Stefan Heidrich
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#----------------------------------------------------------------------------

# Variablen lesen:
. /var/install/include/eislib
. /etc/config.d/eiswetterstation

# Bildrotation in 36 Stunden zur vollen Stunde
minute=`date "+%M"`
if [ "$minute" == "01"  ]; then
    #Bildrotation von Datum und Tendenz
    rm -f /var/eiswetterstation/htdocs/eiswetterstation/png/datum-37.png
    rm -f /var/eiswetterstation/htdocs/eiswetterstation/png/tendenz-37.png
    idx=36
    while [ "$idx" -ge "1" ]
    do
        temp=`/usr/bin/expr $idx + 1`
        mv /var/eiswetterstation/htdocs/eiswetterstation/png/datum-$idx.png 
/var/eiswetterstation/htdocs/eiswetterstation/png/datum-$temp.png
        mv 
/var/eiswetterstation/htdocs/eiswetterstation/png/tendenz-$idx.png 
/var/eiswetterstation/htdocs/eiswetterstation/png/tendenz-$temp.png
        idx=`/usr/bin/expr $idx - 1`
    done
    mv /var/eiswetterstation/htdocs/eiswetterstation/png/datum.png 
/var/eiswetterstation/htdocs/eiswetterstation/png/datum-1.png
    mv /var/eiswetterstation/htdocs/eiswetterstation/png/tendenz.png 
/var/eiswetterstation/htdocs/eiswetterstation/png/tendenz-1.png

    #Bildrotation der Sensordaten
    /usr/bin/netcat $EISWETTERSTATION_IP 5555 | while read templine;
    do
        sens=`echo "$templine" |cut -f 1 -d" "`
        rm -f /var/eiswetterstation/htdocs/eiswetterstation/png/$sens-37.png
        idx=36
        while [ "$idx" -ge "1" ]
        do
            temp=`/usr/bin/expr $idx + 1`
            mv 
/var/eiswetterstation/htdocs/eiswetterstation/png/$sens-$idx.png 
/var/eiswetterstation/htdocs/eiswetterstation/png/$sens-$temp.png
            idx=`/usr/bin/expr $idx - 1`
        done
        mv /var/eiswetterstation/htdocs/eiswetterstation/png/$sens.png 
/var/eiswetterstation/htdocs/eiswetterstation/png/$sens-1.png
    done
fi


# Datum und Zeit in ein PNG schreiben
datum=`date "+%d.%m.%Y"`
zeit=`date "+%H:%M:%S"`

/usr/bin/convert -font $EISWETTERSTATION_PNG_FONT -fill 
$EISWETTERSTATION_PNG_COLOR \
-pointsize "13" -draw "text 6,12 '$datum'" \
/var/eiswetterstation/vorlage.png \
/var/eiswetterstation/htdocs/eiswetterstation/png/datum.png

/usr/bin/convert -font $EISWETTERSTATION_PNG_FONT -fill 
$EISWETTERSTATION_PNG_COLOR \
-pointsize "13" -draw "text 12,26 '$zeit'" \
/var/eiswetterstation/htdocs/eiswetterstation/png/datum.png \
/var/eiswetterstation/htdocs/eiswetterstation/png/datum.png
# HIER BERECHTIGUNG EINGEFÜGT, DIE VORHER NICHT NÖTIG WAR
chmod 644 /var/eiswetterstation/htdocs/eiswetterstation/png/datum.png

# Sensoren auslesen ( speichert jeweilige temp. in 
/var/eiswetterstation/eiswetterstationX )
/usr/bin/netcat $EISWETTERSTATION_IP 5555 | while read templine;
do
    sens=`echo "$templine" |cut -f 1 -d" "`
    wert=`echo "$templine" |cut -f 2 -d" "`
    #echo "$sens"
    #echo "$wert"

    if [ "$sens" == "thb0-fc" ]; then
        cp /var/eiswetterstation/$wert.png 
/var/eiswetterstation/htdocs/eiswetterstation/png/tendenz.png
# HIER BERECHTIGUNG EINGEFÜGT, DIE VORHER NICHT NÖTIG WAR
        chmod 644 
/var/eiswetterstation/htdocs/eiswetterstation/png/tendenz.png
    fi

    case $wert in
        '' | *[.]* )
            wertvor=`echo "$wert" |cut -f 1 -d"."`
            wertnach=`echo "$wert" |cut -f 2 -d"."`
            # LF am Zeilenende entfernen
            echo "$wertvor,$wertnach" > /var/eiswetterstation/temp
            tr '\n' ' ' < /var/eiswetterstation/temp > 
/var/eiswetterstation/$sens
            # Erzeuge PNGs
            if [ "$EISWETTERSTATION_PNG_CREATE" == "yes" ]; then
                /usr/bin/convert -font $EISWETTERSTATION_PNG_FONT \
                -fill $EISWETTERSTATION_PNG_COLOR \
                -pointsize $EISWETTERSTATION_PNG_SIZE \
                -draw "text 12,18 '$wertvor,$wertnach'" \
                /var/eiswetterstation/vorlage.png \
                /var/eiswetterstation/htdocs/eiswetterstation/png/$sens.png
# HIER BERECHTIGUNG EINGEFÜGT, DIE VORHER NICHT NÖTIG WAR
                chmod 644 
/var/eiswetterstation/htdocs/eiswetterstation/png/$sens.png
            fi
        ;;
        '' | *[!.]* )
            # LF am Zeilenende entfernen
            echo "$wert" > /var/eiswetterstation/temp
            tr '\n' ' ' < /var/eiswetterstation/temp > 
/var/eiswetterstation/$sens
            # Erzeuge PNGs
            if [ "$EISWETTERSTATION_PNG_CREATE" == "yes" ]; then
                /usr/bin/convert -font $EISWETTERSTATION_PNG_FONT \
                -fill $EISWETTERSTATION_PNG_COLOR \
                -pointsize $EISWETTERSTATION_PNG_SIZE \
                -draw "text 12,18 '$wert'" \
                /var/eiswetterstation/vorlage.png \
         /var/eiswetterstation/htdocs/eiswetterstation/png/$sens.png
# HIER BERECHTIGUNG EINGEFÜGT, DIE VORHER NICHT NÖTIG WAR
         chmod 644 
/var/eiswetterstation/htdocs/eiswetterstation/png/$sens.png
            fi
        ;;
        *) ;;
    esac

    sleep 1

    idx=1
    while [ "$idx" -le "$EISWETTERSTATION_SENSOR_N" ]
    do
        eval temp1='$EISWETTERSTATION_SENSOR_'$idx'_NAME'
        if [ "$sens" == "$temp1" ]; then
            eval temp2='$EISWETTERSTATION_SENSOR_'$idx'_RRD_LOG'
            if [ "$temp2" == "yes" ]; then
                /usr/local/bin/rrdtool update 
/var/eiswetterstation/$sens.rrd N:$wert 2>/dev/null
            fi
        fi
        idx=`/usr/bin/expr $idx + 1`
    done
done 




Mehr Informationen über die Mailingliste Eisfair