Another reason may be that the path is required.
change dotnet to /opt/dotnet/dotnet
Remember that crontab runs under a reduced environment. It may not have the necessary environment variables. For example echo @DOTNET_ROOT is empty when running as crontab. If you run it as su it returns /opt/dotnet
Consider the user you are running the crontab under. Does it need to be su?
In the end another approach was required: execute bash to run the script. This is the full crontab:
# Added dotnet to the path
MAILTO=""
PATH=/usr/bin:/bin:/opt/dotnet:/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin
SHELL=/bin/bash
# It is necessary to execute bash in order to access the environment variables required for dotnet
* */12 * * * bash -l -c '/home/pi/SmartHome/easy-weatherstation/scripts/publishreadings.sh' > /home/pi/SmartHome/easy-weatherstation/scripts/logs/publishreadings.log 2>&1
*/30 * * * * bash -l -c '/home/pi/SmartHome/easy-weatherstation/scripts/onereading.sh' > /home/pi/SmartHome/easy-weatherstation/scripts/logs/onereading.log 2>&1
No comments:
Post a Comment