Skip to content Skip to sidebar Skip to footer

How To Restart A Python Script After X Amount Of Time?

I have a script that records audio for 15 sec, then kills itself (this needs to happen since that is the only way the recording stops using gstreamer). Now, I want to make this scr

Solution 1:

Use the following:

#!/bin/bash
while [[ 1 ]];do
    myapp &
    pid=$!
    sleep 120
    kill -9 $pid
done

Post a Comment for "How To Restart A Python Script After X Amount Of Time?"