0

When one version of a set of scripts runs, which apply RRDTool, you try more of the same .....

Made a version of the lua-script, which now collects power/energy-info, and the related file create_pipower1A_graph.sh is a direct derivative of the errorfree running sh-file described in RRDTool, How to get png-files by means of os-execute-call from lua-script?

The derivative sh-file should produce a graph with the output of 3 inverters and the parallel consumption. That sh-file for graphic output is below.

#!/bin/bash
rrdtool graph /home/pi/pipower1.png \
  DEF:Pwr_MAC=/home/pi/pipower1.rrd:Power0430:AVERAGE \
  DEF:Pwr_SAJ=/home/pi/pipower1.rrd:Power1530:AVERAGE \
  DEF:Pwr_STECA=/home/pi/pipower1.rrd:Power2950:AVERAGE \
  DEF:Pwr_Cons=/home/pi/pipower1.rrd:Power_Cons:AVERAGE \
  LINE1:Pwr_MAC#ff0000:Output Involar \
  LINE1:Pwr_SAJ#0000ff:Output SAJ1.5 \
  LINE1:Pwr_STECA#5fd00b:Output STECA \
  LINE1:Pwr_Cons#00ffff:Consumption \
  COMMENT:"\t\t\t\t\t\t\l" \
  COMMENT:"\t\t\t\t\t\t\l" \
  GPRINT:Pwr_MAC:LAST:"Output_Involar   Latest\: %2.1lf" \
  GPRINT:Pwr_MAC:MAX:"  Max.\: %2.1lf" \
  GPRINT:Pwr_MAC:MIN:"  Min.\: %2.1lf" \
  COMMENT:"\t\t\t\t\t\t\l" \
  GPRINT:Pwr_SAJ:LAST:"Output SAJ1.5k   Latest\: %2.1lf" \
  GPRINT:Pwr_SAJ:MAX:"  Max.\: %2.1lf" \
  GPRINT:Pwr_SAJ:MIN:"  Min.\: %2.1lf" \
  COMMENT:"\t\t\t\t\t\t\l" \
  GPRINT:Pwr_STECA:LAST:"Output STECA   Latest\: %2.1lf" \
  GPRINT:Pwr_STECA:MAX:"  Max.\: %2.1lf" \
  GPRINT:Pwr_STECA:MIN:"  Min.\: %2.1lf" \
  COMMENT:"\t\t\t\t\t\t\l" \
  GPRINT:Pwr_Cons:LAST:"Consumption    Latest\: %2.1lf" \
  GPRINT:Pwr_Cons:MAX:"  Max.\: %2.1lf" \
  GPRINT:Pwr_Cons:MIN:"  Min.\: %2.1lf" \
  COMMENT:"\t\t\t\t\t\t\l" \
  --width 700 --height 400 \
  --title="Graph B: Power Production & Consumption for last 24 hour" \
  --vertical-label="Power(W)" \
  --watermark "`date`"

The lua-script again runs without errors and as result the rrd-file is periodically updated, the graphic output is generated,but no graph appears! Tested on 2 different Raspberries, but no difference in reactions. Running the sh-file create_pipower1A_graph from the commandline produces the following errors.

pi@raspberrypi:~$ sudo /home/pi/create_pipower1A_graph.sh
ERROR: 'I' is not a valid function name
pi@raspberrypi:~$ ./create_pipower1A_graph.sh
ERROR: 'I' is not a valid function name

Question: Puzzled, because nowhere in the sh-file an I is applied as function command. Explanation? Hint for remedy of this error?

Toulon7559
  • 31
  • 10

1 Answers1

0

Your problem is here:

LINE1:Pwr_MAC#ff0000:Output Involar \
LINE1:Pwr_SAJ#0000ff:Output SAJ1.5 \
LINE1:Pwr_STECA#5fd00b:Output STECA \
LINE1:Pwr_Cons#00ffff:Consumption \

These lines need to be quoted as they contain spaces and hash symbols.

LINE1:"Pwr_MAC#ff0000:Output Involar" \
LINE1:"Pwr_SAJ#0000ff:Output SAJ1.5" \
LINE1:"Pwr_STECA#5fd00b:Output STECA" \
LINE1:"Pwr_Cons#00ffff:Consumption" \
Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • Thanks! Now see the pitfall which trapped me: in the original sh-file I used underscores instead of spaces. ;-) Small details also have effects ........ – Toulon7559 Nov 15 '17 at 09:22
  • Further experimenting found that inside the GPRINT-string enclosed by " ", using ( ) may cause an error (= sh-file not executing). Better to avoid.. – Toulon7559 Oct 10 '18 at 12:12