1

I've made a shell script on a Raspberry Pi to run a video file on loop with no on screen display.

The code at the moment is just

#!/bin/bash

omxplayer [path to file] -o local --no-osd --loop

which I'm then saving in a .sh file and making it executable. This is all with the aim of adding this script to .bashrc to run on startup.

However when I execute the shell script, even just directly from the .sh file, no keyboard presses are detected so there's no way to exit omxplayer.

I just wanted to ask if there's something I'm missing that I could include in the shell script that would allow me to quit omxplayer using the keyboard?

Thank you so much!!!

clo.xyz
  • 11
  • 2
  • have you tried killing the process? e.g.: ```pkill omxplayer``` – Kristian Oct 06 '21 at 08:53
  • @Kristian I've tried but I think the pi isn't picking up the keyboard at all as no keys have any response? So can't even bring up a terminal window. Thanks though! – clo.xyz Oct 06 '21 at 14:53
  • If the rpi is not detecting keystrokes as you say, then how would you expect to end the process with a keystroke? – Teejay Bruno Oct 06 '21 at 15:37
  • I'm guessing your prompt never returns when you start the script because `omxplayer` is still running. So you probably want to put it in the background by adding a space and `&` at the end of the `omxplayer` command. You should be able to stop it with `pkill omxplayer`. Note that `.bashrc` runs when you login, not when you boot. – Mark Setchell Oct 07 '21 at 21:58

0 Answers0