I'm trying to run two simple python scripts from crontab:
@reboot /usr/bin/python3 /home/pi/init_server.py @reboot /usr/bin/python3 /home/pi/scheduler.py
Aug 12 10:07:11 raspberrypi CRON: (root) CMD (/usr/bin/python3 /home/pi/scheduler.py) Aug 12 10:07:11 raspberrypi CRON: (root) CMD (/usr/bin/python3 /home/pi/init_server.py)
Running both these files with the same cmd as in the crontab file works fine, but they are not running after a reboot. Any ideas how i can debug this further.
Code from init_server.script:
import os #starts a server on port 4000 os.system('ruterstop --server')
running a curl command on localhost:4000 doesn't work
---- Update ----
As mentioned in the comments, the server should not be started in python but as a systemctl service.
Another issue i encountered when I added a logfile, is that one of my modules are not found. Even tough it's available when i import it in the shell.
Log from crontab:
Traceback (most recent call last): File "/home/pi/scheduler.py", line 7, in <module> from yr.libyr import Yr ModuleNotFoundError: No module named 'yr'