User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Read an input and kill a process

Tue Jan 27, 2015 3:23 am

Hi i have a script that executes omxplayer at boot which plays a sound.

Code: Select all

cronjob @reboot 
I want the script be able to when i click the enter button kill omxplayer process. Can anybody tell me what i am doing wrong please thanks.

Code: Select all

omxplayer /home/pi/.bootup/shine.mp3
    then
   read -p "Press the [Enter] key to stop omxplayer."
   sudo killall /usr/bin/omxplayer.bin
    
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

ghans
Posts: 7882
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: Read an input and kill a process

Tue Jan 27, 2015 6:34 am

You Problem Program runs in backround and hasn't
got access the terminal and therefore can't read keypresses.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

User avatar
expandables
Posts: 654
Joined: Fri Jun 27, 2014 7:34 pm
Location: Neverland with Michael Jackson

Re: Read an input and kill a process

Wed Jan 28, 2015 1:09 pm

ghans wrote:You Problem Program runs in backround and hasn't
got access the terminal and therefore can't read keypresses.

ghans
Ok thanks but is there any other way to read key inputs?
By thinking like an engineer you can create a raspberry pi.
Michael Jackson enthusiast.
I got the PI model B, B+ and PI 2 model B.
When will I get the A? I don't know.

User avatar
RaTTuS
Posts: 10563
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Read an input and kill a process

Wed Jan 28, 2015 1:11 pm

How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Return to “Beginners”