Here's the story (TL;DR is at the bottom): I've followed the tutorials in the github page and pimylifeup for setting up Alexa on a RPi3. I now have a working Alexa, started with a nice script. Great success!! However, the script opens 3 lxterminal windows and one java window. That's a lot of wasted real estate! So I thought I would use Screen to try and optimize that. I am able to have Alexa working if I execute the 3 scripts inside screen, manually. What I am having issues is with is running a script which automatically sends those commands to screen sessions (having them in a single session, and different shells will be the next step).
TL;DR: Here's what I have:
Starting the wake word detection in a bash script:
pi@pi3:~/shared/Alexa $ cat startAlexainscreen.sh #!/bin/bash screen -dmS "test" #screen -S "test" -p 0 -X exec sh ~/shared/Alexa/3-WakeWord.sh screen -S "test" -p 0 -X exec ~/alexa-avs-sample-app/sample/wakeWordAgent/src/wakeWordAgent -e sensory
checking inside screen "test" after executing the above script:
Cannot exec '/home/pi/alexa-avs-sample-app/sample/wakeWordAgent/src/wakeWordAgent': No such file or directory pi@pi3:~/shared/Alexa $
So it seems it doesn't run the command and it's not taking into account the parameters either. I'm sure I'm missing something terribly basic.
So I tried to put the command inside a bash script:
pi@pi3:~/shared/Alexa $ cat 3-WakeWord.sh #!/bin/bash /home/pi/alexa-avs-sample-app/samples/wakeWordAgent/src/wakeWordAgent -e sensory pi@pi3:~/shared/Alexa $ sh 3-WakeWord.sh Usage: WakeWordAgent -e <engine_type> engine_type options: 'kitt_ai' 'sensory' 'gpio' WakeWordAgent [-h] [--help] prints help (this message)
Seems to run the command, but doesn't take into account the parameters. I've tried escaping the spaces, adding quotation marks, etc...
Thanks for the insights.
As a final result I expect to be able to start the 3 scripts inside a single screen session. Here are the other 2 scripts:
pi@pi3:~/shared/Alexa $ cat 1-npm.sh #!/bin/bash cd ~/alexa-avs-sample-app/samples/companionService npm start pi@pi3:~/shared/Alexa $ cat 2-JVM.sh #!/bin/bash cd ~/alexa-avs-sample-app/samples/javaclient export $DISPLAY=:0.0 mvn exec:exec
Note that starting the commands in scripts 1, 2 and 3 manually inside screen, works perfectly. For some reason, calling these commands inside scripts, fails.