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– Ghanima ♦2015年02月22日 20:28:08 +00:00Commented Feb 22, 2015 at 20:28
2 Answers 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 outputAppend
| logger
to send all script output to syslog
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