I have a simple python script that records 10 minutes of video and then sends the resulting file to an azure blob storage. I want to put it in a docker image and have it run in a kubernetes cluster. I want to set it up in a way that I have (almost) everything recorded (a few seconds missing between recordings dont matter). The obvious problem is that the "send file to storage" part takes a significant amount of time, depending on the network connection. Is there a way to run python in a headless mode so I can do something like that:
#!/bin/bash
while true
do
python3 --headless record_video.py
sleep 10
done
UPDATE: The solution that worked for me was not solving it on "shell level" but ruther on python level using a subprocess that spawns new shells:
import time
from subprocess import Popen
while True:
p = Popen('python video_recording_main.py -u -p -vd 1', shell=True)
time.sleep(60)