mac的crontab 调度
mac的crontab 调度
mac的cron调度默认是从分钟开始,没有秒,这点要注意;
mac的cron调用python
即使安装了anaconda ,环境变量base 是 anaconda 默认的python,但是在cron 调度仍然使用mac系统自带的python
macOS and Linu
-
Open a terminal window.
-
If you want the location of a Python interpreter for a conda environment other than the root conda environment, run
conda activate environment-name
. -
Run
which python.
示例
35 09,10,11,12,13,14,15 * * 1,2,3,4,5 /Users/xxx/anaconda3/bin/python /Users/xxx/OneDrive/python/spyder_projdect_py/stock/run.py >>/Users/xxx/Downloads/logs/$(date +"\%Y-\%m-\%d")stock_py.log 2>&1
参考