make paths work also when executed via crontab

This commit is contained in:
2018-11-27 14:34:54 +01:00
parent a026127902
commit 70da93968f

View File

@ -29,16 +29,17 @@ MAXTEMP=40
# CMD should point to the compiled Adafruit binary that does the acutal reading from the sensor # 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 # 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' # 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 # Location where the readings should be stored
OUTFILE="${PWD}/output" OUTFILE="output"
# #
# no configuration/changes should be necessary below this line # no configuration/changes should be necessary below this line
# #
cd "$(dirname "$0")";
touch "$OUTFILE" 2> /dev/null touch "$OUTFILE" 2> /dev/null
if [ ! -w $OUTFILE ]; then if [ ! -w $OUTFILE ]; then