Project

General

Profile

Problem calling shell scripts via actions

Added by Hasse about 3 years ago

I intend to make a graph using rrdtool graph from a bash script, but it wont work.

I have an action which executes an bash script. In that I execute "rrdtool graph".
But it never succeeds from DomotiGa. I can execute it from terminal and it succeeds.
If I execute another bash script doing this from DomotiGa it will succeed:

echo "test" > /home/pi/OBS/Fixerat.txt

I use chmod 777 because of my problems.

Here's my code:

#!/bin/bash
#Creates graph from 1.rrd.

sudo rrdtool graph 'graphs/graph_001.png' \
--start end-2m \
--title 'Utomhustemperatur' \
--interlace \
--width '800' \
--height '200' \
--color 'ARROW#009900' \
--vertical-label 'Temperatur (°C)' \
--lower-limit '-30' \
--upper-limit '40' \
--border '0' \
--rigid \
'DEF:Utetemp=1.rrd:tempute:AVERAGE' \
'LINE1:Utetemp#669933:Tempen' > log.txt 2> err.txt

Any idea?

Best Regards
Hasse


Replies (4)

RE: Problem calling shell scripts via actions - Added by ThomasDr about 3 years ago

Hello,

what is your command string and where is your Bash script store?
I use php scripts with command php scriptname.php and store the file in the /home/user/
user = your Username.

regards
Thomas

RE: Problem calling shell scripts via actions - Added by Hasse about 3 years ago

Hello!

My command string is:
/home/pi/domotiga/rrd/SkapaGrafer.sh

I have not tried with php script yet.

Best Regards
Hasse

RE: Problem calling shell scripts via actions - Added by ThomasDr about 3 years ago

Hello,

my php was only an Example for you.
try "bash /home/pi/domotiga/rrd/SkapaGrafer.sh"
or try to put it in /home/pi/ with "bash SkapaGrafer.sh".
For a trial set permission to 777.

regards
Thomas

RE: Problem calling shell scripts via actions - Added by Hasse about 3 years ago

Hello!

Success!
Now my script Works!
I don't even need to use "bash" in front.

But I need to put it were you suggested.
/home/pi/SkapaGrafer.sh
That's Strange, isn't it?

Thank you very much!
/Hasse

    (1-4/4)