cronからvenvに入ってPythonスクリプトを実行する2021/8/18 / 1 min readView more blogs with the tag python, View more blogs with the tag ubuntuTable of Contents#はじめに#方法はじめに cronからvenvに入ってPythonスクリプトを実行する方法です。 方法 Terminal window$ crontab -e* * * * * cd 実行したい.pyがある絶対パス(\*1); venv環境名の絶対パス/bin/python hoge.py # 記載例33 16 * * * cd /home/ubuntu/app; /home/ubuntu/env_test/bin/python test.py >> /tmp/cron.log 2>&1 >> /tmp/cron.log 2>&1 でログ(標準出力とエラー出力)を出力