Run Pyenv Python in Crontab

February 21, 2021

Create a script: /script/test.sh

#!/bin/bash
export PATH="/home/$USER/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
#. /home/$USER/.bashrc

pyenv activate PYENV
cd /code/PROJECT
python test.py

crontab -e

* * * * * . /script/test.sh

NOTE: Run script every minutes

This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.