S
S
ssssergey2017-06-18 20:50:46
Python
ssssergey, 2017-06-18 20:50:46

Why doesn't cron run python script from under virtual environment?

Here is a cron task:

*/20 * * * * source /home/user/venv/bin/activate && python /home/user/project/main.py && deactivate

Cron runs it regularly at the right time (checked in /var/log/syslog). But the script itself does not work.
It does not work both from under the root and from under the user.
Tried to run this command manually. Works fine.
Another task that does not use virtualenv works fine.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tema_sun, 2017-06-18
@tema_sun

Instead of
call immediately python
/home/user/venv/bin/python

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question