Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if cronjob is failing (running a python command)

When I run this command, the output message is being saved into ok.txt:

 /home/admin/virtualenvs/x.com/bin/python /home/admin/www/x.com/x/app/manage.py help | tee ok.txt

I have this cronjob:

* * * * * /home/admin/virtualenvs/x.com/bin/python /home/admin/www/x.com/x/app/manage.py help | tee ok.txt

But nothing is saved to ok.txt

When I see the cron log

> sudo grep CRON /var/log/syslog

May 10 22:16:01 localhost CRON[23397]: (admin) CMD (/home/admin/virtualenvs/x.com/bin/python /home/admin/www/x.com/x/app/manage.py help | tee ok.txt)

No hints here, what am I doing wrong? thanks in advance.

like image 577
panchicore Avatar asked Nov 28 '25 06:11

panchicore


1 Answers

try with this :

* * * * * /home/admin/virtualenvs/x.com/bin/python /home/admin/www/x.com/x/app/manage.py help > /tmp/ok.txt 2&>1

it should put all outputs (stderr and stdout) into your ok.txt file

like image 179
Cédric Julien Avatar answered Nov 29 '25 20:11

Cédric Julien



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!