简体   繁体   中英

Raspberry Pi bash script not functioning

I have a Raspberry Pi and I picked up a tft touch screen from adafruit to play around with. In order to get it working I've had to run a few lines from from rc.local including startx which for some reason has logged me in as root@raspberrypi once the OS on the touchscreen starts working.

Once the OS is running on the touch screen, I need to run two programs, matchbox-keyboard and pianobar both of which run just fine by typing in "matchbox-keyboard", and "pianobar" from the LXTerminal.

However, if I try to add "matchbox-keyboard" or "pianobar" to rc.local under either the root rc.local or pi rc.local the programs will not run.

I tried to get around this by adding a file, keyboard.sh which I have given permissions to (chmod u+rwx keyboard.sh) to my desktop which has the lines:

#!bash
matchbox-keyboard
pianobar

The file is there, and when clicked asks me to either execute, or execute in terminal, both of which do not work.

I'm stumped. Anyone have any Ideas?

I'm not sure how Debian is organized, but if rc.local is a file under /etc/rc.d the system will automatically run any commands from this file at the end of system initialization, so just filling the rc.local file with this would be enough (I'm supposing matchbox-keyboard is blocking, that's why I'm starting it on the background with the & ):

matchbox-keyboard &
pianobar

Just the fact you have a keyboard.sh file at the /etc/rc.d dir doesn't mean it will get executed, even if it has +x permission. The file rc.local with exec permission, on the other hand, gets executed because it is run from /etc/rc.d/rc.M (I suppose it is like this on any Linux which uses BSD-style init scripts, like Slackware, for example).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM