0

I'm trying to run a command by cron in Raspbian.

If I run ./sec_cam.sh, than my script runs, If I try to run it via crontab every 5 min, than nothing happens.

crontab -e shows me the followings:

*/5 * * * * ./sec_cam.sh

Did I configure the crontab wrong? Thx in advance

mnagel
  • 6,729
  • 4
  • 31
  • 66
Joey
  • 23
  • 2

1 Answers1

1

scripts started from a cronjob are not setup with your usual environment, especially not with your current working directory (referenced by the . in ./sec_cam.sh). so to make this work you should specify a full path name like /home/user/sec_cam.sh

mnagel
  • 6,729
  • 4
  • 31
  • 66
  • Hi, thanks for your suggestion. I changed the command, but I'm still getting error in the syslog file: /USER/SBIN/CRON[2500]: (pi) CMD (/home/pi/sec_cam.sh) – Joey Sep 16 '13 at 13:35
  • cron logs its invocations in the syslog. this is not necessarily an error. cron reports all errors via mail. you should setup you system to send your emails. read about nullmailer to find out how to do this in a contemporary manner. – mnagel Sep 16 '13 at 13:39
  • As I understand the crontab runs the script, but for some reason I don't see the result? And the error report should clear it up. Correct? – Joey Sep 16 '13 at 13:43
  • as mentioned above -- syslog is not only an error log. as for the output: where do you expect to see it? all output on stdout and stderr will be sent to your local users mailbox, and you should really redirect it to your gmail/company-mail/whereever. also you should probably redirect the output to a file using shell redirection (`>`) because thats more convenient. – mnagel Sep 16 '13 at 13:48
  • Thanks a lot, I appreciate your help. The script supposed to start guvcview video recording, but it doesn't start it. Probably I have to dig deaper in this. Thanks for the help again. – Joey Sep 19 '13 at 07:55