1

I have a python script that I would like to run in every hour.
The cron command look like this:

54 * * * * root python /home/pi/moka/olx_multi.py 2>&1

The script is not running and I always get the same error without any information about the error real reason. The error message look like this:

Feb 22 19:54:01 raspberrypi /USR/SBIN/CRON[30216]: (root) CMD (python /home/pi/moka/olx_multi.py 2>&1)
Feb 22 19:54:01 raspberrypi /USR/SBIN/CRON[30215]: (CRON) info (No MTA installed, discarding output)

Can anyone spot what I'm doing wrong?

  • The script is probably running. Just the output (stdout and redirected stderr) are discarded as cron is not attached to any shell - no where to output to. – Ghanima Feb 22 '15 at 20:28
2

You have a few options:

  • Install an MTA and receive all script output in the user's e-mail address: sudo apt-get install postfix. By default the mail will be delivered to a local mailbox in /var/spool/mail/[username]

  • Replace 2>&1 by >/dev/null 2>&1 to ignore the script output

  • Append | logger to send all script output to syslog

1

Does you script work when running manually? If yes, I think you should specify full path to python interpreter:

54 * * * * root /usr/bin/python /home/pi/moka/olx_multi.py 2>&1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.