@reboot: command not found
BrahmaFarmsLLC opened this issue · 9 comments
I am having issues when I did the crontab entry
@reboot /home/pi/EnvironmentMonitor/.venv/bin/python3 /home/pi/EnvironmentMonitor/app.py
What issues are you having? When raising a GitHub issue can you please provide more information such as:
- What problem you are having including error messages
- What you did to give the problem
- What steps you took to fix the problem
Sorry for premature description of the issue. The issue is under the
step#3: Write the code to capture telemetry from the Raspberry Pi
under section 'Run the Python app continuously'
- Add the following line to the end of the file:
@reboot /home/pi/EnvironmentMonitor/.venv/bin/python3 /home/pi/EnvironmentMonitor/app.py
You still haven’t said what the issue is.
I am not receiving the data on the IoT portal. when I try to run the command manually getting this error
@reboot: command not found
You can't run that command locally -that is a crontab entry, so is triggered on rebooting the device.
Have you tried running the code directly on the Pi? Connect via VS Code, open the folder, ensure the virtual environment is activated then from the terminal do:
python app.py
Does this sent data to IoT Central?
Just to check a few things:
-
is your username on the pi the default of
pi
? -
If you run the full command
home/pi/EnvironmentMonitor/.venv/bin/python3 /home/pi/EnvironmentMonitor/app.py
does it work? -
How is your pi connecting to the internet?
-
There could be an issue where the app is starting up but the Pi isn't connected to the internet, so can you try setting the crontab entry to:
@reboot sleep 60 && home/pi/EnvironmentMonitor/.venv/bin/python3 /home/pi/EnvironmentMonitor/app.p
This will sleep for 1 minute before launching the app
It is working now.