raspivid and cron - Raspberry Pi Forums
hello,
want set video surveillance recording following tutorial:
http://www.instructables.com/id/stand-a ... h-raspber/
script executes raspivid working perfectly, problem cron, after setting "crontab -e" doesn't start "record.sh" script. if start manually script working.
"crontab -e" part following:
*/15 * * * * sudo sh /home/pi/record.sh >> /home/pi/video.log 2>&1
* */1 * * * sudo find /mnt/video/* -mmin +360 -exec rm -f {} \; >> /home/pi/video.log 2>&1
think wrong there? bellow ps aux cron:
root 352 0.0 0.2 5288 2468 ? ss 21:27 0:00 /usr/sbin/cron -f
root 1226 0.0 0.0 4368 532 pts/1 s+ 21:44 0:00 grep cron
, systemctl status cron
● cron.service - regular background program processing daemon
loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
active: active (running) since sun 2017-09-10 21:27:04 eest; 18min ago
docs: man:cron(8)
main pid: 352 (cron)
cgroup: /system.slice/cron.service
└─352 /usr/sbin/cron -f
sep 10 21:45:01 raspberrypi cron[1234]: (pi) cmd (sudo find /mnt/video/* -mmin +2880 -exec rm -f {} \; >> /home/pi/video.log 2>&1)
sep 10 21:45:01 raspberrypi cron[1237]: (root) cmd (sudo find /mnt/video/* -mmin +2880 -exec rm -f {} \; >> /home/pi/video.log 2>&1)
sep 10 21:45:01 raspberrypi sudo[1236]: pi : tty=unknown ; pwd=/home/pi ; user=root ; command=/usr/bin/find /mnt/video/10092017-212
sep 10 21:45:01 raspberrypi sudo[1238]: root : tty=unknown ; pwd=/root ; user=root ; command=/usr/bin/find /mnt/video/10092017-212930
sep 10 21:45:01 raspberrypi sudo[1236]: pam_unix(sudo:session): session opened user root (uid=0)
sep 10 21:45:01 raspberrypi sudo[1238]: pam_unix(sudo:session): session opened user root (uid=0)
sep 10 21:45:01 raspberrypi sudo[1236]: pam_unix(sudo:session): session closed user root
sep 10 21:45:01 raspberrypi sudo[1238]: pam_unix(sudo:session): session closed user root
sep 10 21:45:01 raspberrypi cron[1227]: pam_unix(cron:session): session closed user pi
sep 10 21:45:01 raspberrypi cron[1228]: pam_unix(cron:session): session closed user root
guys think? wrong?
thank you
want set video surveillance recording following tutorial:
http://www.instructables.com/id/stand-a ... h-raspber/
script executes raspivid working perfectly, problem cron, after setting "crontab -e" doesn't start "record.sh" script. if start manually script working.
"crontab -e" part following:
*/15 * * * * sudo sh /home/pi/record.sh >> /home/pi/video.log 2>&1
* */1 * * * sudo find /mnt/video/* -mmin +360 -exec rm -f {} \; >> /home/pi/video.log 2>&1
think wrong there? bellow ps aux cron:
root 352 0.0 0.2 5288 2468 ? ss 21:27 0:00 /usr/sbin/cron -f
root 1226 0.0 0.0 4368 532 pts/1 s+ 21:44 0:00 grep cron
, systemctl status cron
● cron.service - regular background program processing daemon
loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
active: active (running) since sun 2017-09-10 21:27:04 eest; 18min ago
docs: man:cron(8)
main pid: 352 (cron)
cgroup: /system.slice/cron.service
└─352 /usr/sbin/cron -f
sep 10 21:45:01 raspberrypi cron[1234]: (pi) cmd (sudo find /mnt/video/* -mmin +2880 -exec rm -f {} \; >> /home/pi/video.log 2>&1)
sep 10 21:45:01 raspberrypi cron[1237]: (root) cmd (sudo find /mnt/video/* -mmin +2880 -exec rm -f {} \; >> /home/pi/video.log 2>&1)
sep 10 21:45:01 raspberrypi sudo[1236]: pi : tty=unknown ; pwd=/home/pi ; user=root ; command=/usr/bin/find /mnt/video/10092017-212
sep 10 21:45:01 raspberrypi sudo[1238]: root : tty=unknown ; pwd=/root ; user=root ; command=/usr/bin/find /mnt/video/10092017-212930
sep 10 21:45:01 raspberrypi sudo[1236]: pam_unix(sudo:session): session opened user root (uid=0)
sep 10 21:45:01 raspberrypi sudo[1238]: pam_unix(sudo:session): session opened user root (uid=0)
sep 10 21:45:01 raspberrypi sudo[1236]: pam_unix(sudo:session): session closed user root
sep 10 21:45:01 raspberrypi sudo[1238]: pam_unix(sudo:session): session closed user root
sep 10 21:45:01 raspberrypi cron[1227]: pam_unix(cron:session): session closed user pi
sep 10 21:45:01 raspberrypi cron[1228]: pam_unix(cron:session): session closed user root
guys think? wrong?
thank you
well, first of instructable written thinks need sudo every command.
afaict none of these necessary...
how know script not started? have checked log file?
can't tell journal, lines starting / not starting first script ones before ones can see in status check.
add echo line in first script; should show in video log file.
should use full paths programs , other files in scripts. cannot assume in path when script runs (especially when running them user, root).
raspberrypi
Comments
Post a Comment