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?

asked Feb 22, 2015 at 20:21
1
  • 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. Commented Feb 22, 2015 at 20:28

2 Answers 2

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

answered Feb 22, 2015 at 21:43
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
answered Feb 22, 2015 at 21:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.