From 70da93968fea291b5f3d627d8f11792cd4e7504d Mon Sep 17 00:00:00 2001 From: Der_Leopold Date: Tue, 27 Nov 2018 14:34:54 +0100 Subject: [PATCH] make paths work also when executed via crontab --- readSensor.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readSensor.sh b/readSensor.sh index f57bf2c..a7b1538 100755 --- a/readSensor.sh +++ b/readSensor.sh @@ -29,16 +29,17 @@ MAXTEMP=40 # CMD should point to the compiled Adafruit binary that does the acutal reading from the sensor # See https://github.com/adafruit/Adafruit_Python_DHT for details # The 'sudo' is not needed if the user executing the script is member of the group 'gpio' -CMD="sudo ${PWD}/external/Adafruit_Python_DHT/examples/AdafruitDHT.py" +CMD="sudo ./external/Adafruit_Python_DHT/examples/AdafruitDHT.py" # Location where the readings should be stored -OUTFILE="${PWD}/output" +OUTFILE="output" # # no configuration/changes should be necessary below this line # +cd "$(dirname "$0")"; touch "$OUTFILE" 2> /dev/null if [ ! -w $OUTFILE ]; then