我正在尝试定期运行selenium脚本并显示,尽管没有执行该脚本。运行虚拟作业表明cron可以工作,尽管同样的工作不适用于python3 3//selenium脚本。我的crontab -l输出:
SHELL=/bin/bash
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12)
# │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday;
# │ │ │ │ │ 7 is also Sunday on some systems)
# │ │ │ │ │
# │ │ │ │ │
# * * * * * command_to_execute
12 18 * 5-8 1-5 export DISPLAY=:0; /Users/eshauchuk/opt/anaconda3/bin/python3 /Users/eshauchuk/checkout.py
12 18 * 5-8 1-5 /Users/eshauchuk/opt/anaconda3/bin/python3 /Users/eshauchuk/checkout.py
除了提到脚本应该在bash中运行之外,还指定了显示的需要,尽管到目前为止还没有结果。如有任何帮助,我将不胜感激!
发布于 2020-05-20 14:07:43
通过指定显示和路径解决问题:
* * * * * export DISPLAY=:0 && export PATH=$PATH:/usr/local/bin && /Users/username/opt/anaconda3/bin/python3 /Users/username/checkout.py >> crontab.txt
使用anaconda的python
https://stackoverflow.com/questions/61880740
复制相似问题