0

I need to play an audio file and after 3 minutes close it, then all over again. play it 3 minutes and close it.

Currently I'm using a cron job to open the file in VLC and close it, but it's not good enough as it goes out of sync every once in a while.

Is there any alternative to this task with using a cron job?

*/3 * * * * cvlc /home/pi/Downloads/buildm3u
*/3 * * * * sleep 178; pkill vlc
  • 2
    use just one cronjob with timeout 178 cvlc .... – pLumo Apr 9 at 13:36
  • Will try, thanks @RoVo! – Dante Apr 9 at 13:42
  • Is the audio file only 3 minutes long? Or is it longer and you just want to play 3 minutes of it? – JShorthouse Apr 9 at 13:47
  • It's a streaming file so it's basically endless. – Dante Apr 9 at 14:05
  • Hi @RoVo, it seems that the command is ignored. " */3 * * * * timeout -s 2 180 python3 /home/pi/test.py " and also I tried: " */3 * * * * timeout 180 python3 /home/pi/test.py " I'm testing it with a python script, and it seems it just keeps running. – Dante Apr 9 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.