LoginSignup
2
2

More than 3 years have passed since last update.

cronから仮想環境venvのスクリプトを実行する

Posted at

https://github.com/kazuho/kaztools/blob/master/cronlog
cron で > /dev/null して椅子を投げられないための3つの方法 - 酒日記 はてな支店

$ cd tmp
$ python3 -m venv venv
$ pip install requests
$ cat p.py
import requests
$ cat /etc/cron.d/test
*/1 * * * * k8uwall cd /home/k8uwall/tmp; /usr/local/bin/cronlog --timestamp -- venv/bin/python p.py

# tail -f /var/log/cron
Dec  8 21:53:01 k8uwallsv CROND[6402]: (k8uwall) CMD (cd /home/k8uwall/tmp/c/; /
usr/local/bin/cronlog --timestamp -- venv/bin/python p.py)
2
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
2
2