Answer the question
In order to leave comments, you need to log in
Why is the script not being executed in crontab -e?
Need help from a non-professional.
So, there is a homemade WiFi camera for Raspberry PI (Raspbian). Installed MJPG-Streamer, you need to save pictures from the camera every 5 minutes. I'm trying to make it run a shell script through crontab -e, where I ran into difficulties
. The bottom line is that the script is not executed from under cron, despite the fact that it works correctly by itself (presented below)
Crontab -e :
# m h dom mon dow command
*/5 * * * * sh /home/pi/mjpg-streamer/make_photo.sh 2>/var/log/make_photo
#!/bin/bash
D=`date +\%d.\%m.\%Y-\%H.\%M.\%S`
/usr/bin/wget http://192.168.0.93:8081/?action=snapshot -O /media/motion/pic_$D.jpg
[email protected]:~ $ sudo service cron status
does not output any errors:● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled)
Active: active (running) since Вт 2017-05-09 15:02:34 MSK; 2h 18min ago
Docs: man:cron(8)
Main PID: 464 (cron)
CGroup: /system.slice/cron.service
└─464 /usr/sbin/cron -f
май 09 17:15:01 camera CRON[2661]: (pi) CMD (sh /home/pi/mjpg-streamer/make_photo.sh 2>/var/log/make_photo)
май 09 17:15:01 camera CRON[2657]: (CRON) info (No MTA installed, discarding output)
май 09 17:15:01 camera CRON[2657]: pam_unix(cron:session): session closed for user pi
май 09 17:17:01 camera CRON[2680]: pam_unix(cron:session): session opened for user root by (uid=0)
май 09 17:17:01 camera CRON[2684]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
май 09 17:17:02 camera CRON[2680]: pam_unix(cron:session): session closed for user root
май 09 17:20:01 camera CRON[2712]: pam_unix(cron:session): session opened for user pi by (uid=0)
май 09 17:20:01 camera CRON[2716]: (pi) CMD (sh /home/pi/mjpg-streamer/make_photo.sh 2>/var/log/make_photo)
май 09 17:20:01 camera CRON[2712]: (CRON) info (No MTA installed, discarding output)
май 09 17:20:01 camera CRON[2712]: pam_unix(cron:session): session closed for user pi
Answer the question
In order to leave comments, you need to log in
All earned! As I thought, "the fool himself" turned out to be.
The error was in the entry of the command itself in crontab, it was necessary to specify/bin/sh
Thank you for your help
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question