64mp Cronejob Automatic recording of 4 images in full resolution

I wrote a small script to automatically switch between the cameras to take a picture in full resolution with each camera, this also works. But if I want to run this as a cronjob every 5 minutes, it does not change the cameras. can someone explain to me what I’m doing wrong?

#!/bin/bash
DATE=$(date +“%Y-%m-%d_%H%M%S”)
i2cset -y 10 0x24 0x24 0x02
libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 -o /home/basti/timelapse/$DATE.jpg
sleep 5
i2cset -y 10 0x24 0x24 0x12
libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 -o /home/basti/timelaps2/$DATE.jpg
sleep 5
i2cset -y 10 0x24 0x24 0x22
libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 -o /home/basti/TL3/$DATE.jpg
sleep 5
i2cset -y 10 0x24 0x24 0x32
libcamera-still -t 5000 --viewfinder-width 2312 --viewfinder-height 1736 -o /home/basti/TL4/$DATE.jpg

@basfantas

I don’t know much about cronjob.

The script itself is fine.

Can you be more specific about how it doesn’t change?

When I run the script through a cronjob, pictures are taken but always from the same camera that was active in the beginning.
If I start the script manually, it also changes the camera between the images.
So in the cronjob the command to change the camera is not executed.

@basfantas

I tried and found something interesting.

I added log printing and found that the command was not searched
image

It only takes effect when I use full power

/usr/sbin/i2cset