shell - Python script in bash with crontab doesn't work but without crontab it does -
shell - Python script in bash with crontab doesn't work but without crontab it does -
i have bash script taking image raspberry pi photographic camera , measuring humidity , temperature python script.
#!/bin/bash raspistill -o /var/www/image.jpg -t 1000 python adafruit_python_dht/examples/adafruitdht.py 2302 4 | tr -s ' ' | grep -o '[0-9]\+\.[0-9]\+' > /var/www/sensor.out
the bash script works if execute normally, if set in crontab (as root) still executes first line sec line returns empty file. removes not replace old info.
pi@rpi ~ $ sudo crontab -e gnu nano 2.2.6 file: /tmp/crontab.y0eief/crontab shell=/bin/sh path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/pi */1 * * * * /home/pi/testcron.sh
i have no thought why isn't working, maybe because of named pipes?
you have relative path specified in script, don't start in home directory cronjob. utilize absolute paths in bash script.
bash shell cron crontab
Comments
Post a Comment