Crontab and python project

209 views Asked by At

I have a simple python project to water my plants, it works with a Raspberry and RaspberryPi os lite. In the project I have a package named app with a __main__.py to launch it, I just type python -m app in the terminal and it works fine. I tried to make a crontab with * * * * * /usr/bin/python /home/pi/djangeau/app Nothing happens, whereas if I launch a simple python test script it does. The cron log gives me that error : 'No MTA installed, discarding output' , not sure this is useful to solve the problem. I hope I was clear enough. Thank you for your answers. Vincent

2

There are 2 answers

0
Vincent74 On

Finally I figured out:

For exemple that command in bash : python -m app is equivalent to this one for a crontab : * * * * * cd /home/pi/djangeau && /usr/bin/python -m app

Just replace the correct path and stars by the schedule you want

0
Mustafa Jawed On

MTA is for mailing purposes as cron sends email whereas ubuntu doesn't have MTA. Below is the link for a better understanding:

https://askubuntu.com/questions/222512/cron-info-no-mta-installed-discarding-output-error-in-the-syslog