0

I entered this command to execute:

* * * * * python/home/pi/Desktop/sensor.py >> /var/log/gasdetails.log 2>&1  

but it gives an info:

Dec 22 21:08:01 raspberrypi CRON[2070]: (CRON) info (No MTA installed, discarding output)

muru
  • 197,895
  • 55
  • 485
  • 740
  • 2
    If you're trying to execute the command python with the name of your program as its argument then you need to separate them with whitespace ex. python /home/pi/Desktop/sensor.py – steeldriver Dec 22 '20 at 15:57
  • 2
    The error you are seeing is not related to your script, but to the fact that no Mail Transfer Agent (MTA) is installed in your system. – dariofac Dec 22 '20 at 15:59
  • You can also implement the timer into the python script. I found this post on stackoverflow. – kabr8 Dec 22 '20 at 16:00

1 Answers1

2

As I understand it, this message informs you that your cron job has been executed, but output produced by it cannot be mailed to you because there is no Mail Transfer Agent installed on this machine.

I only wonder what output could it produce if you redirected everything to file. As one of the comments suggests, it may be an error message related to the fact that you probably don't have a file python/home/pi/Desktop/sensor.py on your system, so it cannot be executed. If you want to have the file /home/pi/Desktop/sensor.py executed by python interpreter (which is probably what you meant), you should write it as python /home/pi/Desktop/sensor.py (note the space).

Or do it "the proper Linux way" ;) - insert #!/usr/bin/python as the first line of your script, make the file executable and call it just as /home/pi/Desktop/sensor.py

raj
  • 10,353