LoginSignup
0
2

More than 1 year has passed since last update.

ラズパイでPythonのvenvを使いつつCronで定期的に自動実行する方法

Posted at

Pythonスクリプトをvenv環境下で起動する、Crontab設定を記述してみた。

Windows上で開発していたプログラムをRaspberryPiに移植したときに、日々手動で実行するのもめんどくさいし、実行するのを忘れたりすることも多々あったので、自動化するべと意気込んでやってみた。

実際に行った作業

まずはcrontab -e を実行。
crontab.jpg
cron上で、まずカレントディレクトリを移動して、仮想環境の.venv/binにあるpythonでpyファイルを起動するという感じ。
crontab2.jpg

参考にしたのは以下の記事
cronの書式で曜日指定に数字を使うのやめたい
venv環境でpythonスクリプトをcronで周期実行

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2