I have a cron job running a ruby script, here is crontab
* * * * * /usr/bin/ruby /home/pi/runbot.rb
permissions look like this
pi@pi $ ls -l runbot.rb
-rwxr-xr-x 1 pi pi 859 Aug 26 14:16 runbot.rb
More info
grep cron /var/log/syslog
Aug 26 17:21:42 pi crontab[5278]: (pi) BEGIN EDIT (pi)
Aug 26 17:21:54 pi crontab[5278]: (pi) REPLACE (pi)
Aug 26 17:21:54 pi crontab[5278]: (pi) END EDIT (pi)
Aug 26 17:22:01 pi /usr/sbin/cron[3217]: (pi) RELOAD (crontabs/pi)
Some more info
tail cron /var/log/syslog
Aug 26 17:23:01 pi /USR/SBIN/CRON[5289]: (CRON) info (No MTA installed, discarding output)
Aug 26 17:24:01 pi /USR/SBIN/CRON[5294]: (pi) CMD (ruby /home/pi/runbot.rb)
Aug 26 17:24:02 pi /USR/SBIN/CRON[5293]: (CRON) info (No MTA installed, discarding output)
Aug 26 17:25:01 pi /USR/SBIN/CRON[5298]: (pi) CMD (ruby /home/pi/runbot.rb)
Aug 26 17:25:02 pi /USR/SBIN/CRON[5297]: (CRON) info (No MTA installed, discarding output)
Pi model B, rasbian
2 Answers 2
The problem was with my paths. Since I am using rvm with ruby I ran
rvm cron setup
from my working directory to setup my crontab.
I then added the path to my directory to the PATH in crontab made by rvm
Took a day to figure this out.
I think your error is that you have no mailer installed on the Pi.
I think maybe postfix
can make thinks work here.
sudo apt install postfix
Also it would be better to analyze any errors in the script by using a subshell and sending the STDERR to STDOUT.
* * * * * (/usr/bin/ruby /home/pi/runbot.rb) > /dev/null 2>&1
if you want to know what 2>&1
means here use This Reference
There might be other options too, instead of postfix
maybe mailx
can work too.
sudo apt install mailx
but you might want to check on that first
-
No, that is not the issue.JanuskaE– JanuskaE2016年08月26日 19:41:14 +00:00Commented Aug 26, 2016 at 19:41
sleep 30; your script
in crontab