banool / recreation-gov-campsite-checker

Scrapes the recreation.gov website to check for campsite availabilities 🏕🏕
Apache License 2.0
321 stars 166 forks source link

Trouble implementing in cron #28

Open jwright174 opened 3 years ago

jwright174 commented 3 years ago

Hi there, I'm able to get the script to run perfectly when launched from the terminal window, but run into issues when I try to command it through cron. Could anyone post the syntax their using for their cronjob? Mine is below. seems to be able to check the sites fine but has trouble handing off to the notifier.

(sorry if its obvious, I'm new and grateful for any pointers)

cronjob:

cron.log output: Traceback (most recent call last): File "notifier.py", line 8, in from camping import SUCCESS_EMOJI File "/home/pi/Documents/Python/recreation-gov-campsite-checker/camping.py", line 10, in from dateutil import rrule ImportError: No module named dateutil

mlgold commented 3 years ago

cron runs jobs with a minimal path that does not include the python modules. This may be solved by any method to set the PATH to the correct value. I created a shell script that, among other things, sets the PATH first and then runs the python.