[Solved] Alexa ran by CRONTAB results in crash

I have Alexa working well when I run the sample app from terminal connected by SSH.

When I have it auto run on boot using crontab, it works fine for about three commands and then the PI locks up requiring a hard reset. It can’t be accessed remotely any more.

Any thoughts as to why it would not be stable when auto started at boot? Could it have something to do with all the text that is normally output, but in this case output to no active terminal?

Thanks,
Sean

Not sure what could be the issue here. Can you try to pipe that text to a file when starting the app?

Have you tried to start the Alexa app using a service instead? see here for an example .

-Yoel

Thanks for the tips. I tried the service approach. It gave the same results. It took a few commands, but then bricked again. When it bricks, all lights are white and it requires cycling the power.

I ran the service log and it gave the following:

Jun 25 23:55:02 ClockCrane2 SampleApp[727]: # Invalid Option #
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: ##############################
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: # Invalid Option #
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: ##############################
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: # Invalid Option #
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: ##############################
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: # Invalid Option #
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: ##############################
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: # Invalid Option #
Jun 25 23:55:02 ClockCrane2 SampleApp[727]: ##############################

This makes me think that perhaps it has something to do with the sample app polling for keyboard input. This leads me to a couple of questions:

What is the DEBUG9 at the end of the startsample.sh call?

Where is the code for polling for keyboard presses?

Thanks,
Sean

Found a solution.

I edited the source files of the Alexa SampleApp using tips from this blog:

https://developer.amazon.com/docs/alexa-voice-service/indicate-device-state-with-leds.html

I edited ConsolePrinter.cpp and commented out std::cout lines.
I edited UIManager.cpp and commented out the insides of the while(true) block that takes in keyboard input.

In turn, there is no console interaction that could make it subject to conflicts.

I tested the crontab @reboot approach and had no issues. I then converted to the service approach and it too had no issues!

I’m marking this solved, but still wonder what DEBUG9 does.

Thanks,
Sean

Debug logs are available in DEBUG builds. You can enable them by adding the following to the end of your cmake command line:

See more here Linux Reference Guide · alexa/avs-device-sdk Wiki · GitHub