0

I have a C program I wrote for debian on the raspberry pi that asks the user to enter a number, 1-4 which it then stores in a configuration file. This only happens if the configuration file is missing. I'd like to run this program on boot. Problem is, I can get it to run on boot, but haven't had any luck getting the terminal window to show up so I can see it. I've tried editing /etc/rc.local and adding commands there. I've tried editing crontab. I've tried all the tricks with "export display=:0 && command". Any suggestions?

Edit:

Here is the command I am actually running in /etc/rc.local:

x-terminal-emulator --command=/opt/vc/src/hello_pi/initialConfig/./initialConfig.bin --display=:0

The program uses scanf() to capture keyboard input and display feedback.

2 Answers 2

1

You're not going to be able to run any X window terminals during boot. The run level you're in doesn't have a X server running. So you could do something like this in your /etc/rc.local which could then collect input from the user and then call your executable with it.

#!/bin/sh
INPUT_STRING=hello
while [ "$INPUT_STRING" != "bye" ]
do
  echo "Please type something in (bye to quit)"
  read INPUT_STRING
  echo "You typed: $INPUT_STRING"
done

myexec $INPUT_STRING

This is only an example, you'd need to change it to suite your needs.

1
  • Tried your suggestion, but still don't have anything showing up on the screen on boot. I originally had #!/bin/sh -i, but tried it both with and without -i. No luck. Could there be something wrong with my setup? Commented Aug 12, 2013 at 16:23
0

I finally figured it out. In your users home directory you have to create a file called autostart at the path /.config/lxsession/LXDE/ and just add whatever command you want to execute after login to the autostart file.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.