0

I've set up a cron task to run my script called outcam.sh. This script opens a camera, prints "Program launched" and records a .dat file for every frame. It will also output a line of text if it drops frames anywhere.

My cron task looks like this:

12 15 * * * ~/opencam.sh >> ~/out.txt

After attempting a few times I only see the initial message "Program launched" appear in my out.txt file. The .dat files however do not get generated and the error messages for dropped frames also do not appear.

I don't really have the strongest knowledge of the camera software as it was provided by the manufacturer, but is anyone able to provide insight as to why this approach might be faulty?

Paul
  • 1
  • 1
    You are only redirecting stdout with >>, not stderr. The script is probably printing those messages to stderr. See https://unix.stackexchange.com/questions/132511/how-to-capture-error-message-from-executed-command – Panki Dec 16 '22 at 15:16
  • 2
    @Panki There also appears to be missing files, not just partial output. However, once the standard error stream is captured, maybe that info can shed a light on what happens to the missing data? – Kusalananda Dec 16 '22 at 15:28
  • I added '2>&1' to the end of my cron task. Now I get the error message, this states that the program raspberrypi_video cannot connect to X server. I have used ssh -Y to connect to my raspberry pi and when manually opening the camera it displays fine (i do not need to specify anything to get the program to connect to X server). Very unsure why this is now the case – Paul Dec 19 '22 at 16:14

0 Answers0