Try it in rc.local. You might find these complications:
1. When you start kde, you'll have to figure out a way to know it's all the way up before running the application. I can't help you with that. Maybe you can time how long it normally takes kde to come up, and double that just to be sure.
2. Once you know that kde is up, don't just start the application. Wrap a script around that which (1) runs your application, and (2) asks whether the system should be shut down. Step 2 should be done so that the question is visible on the kde screen. To do that, put the asking of that question in a separate script (let's assume that the script is called fred), and run that by doing something like this:
Code:
xterm -e /bin/bash -c /fullpath/fred
Note that the -c option is for bash, and the -e option is for xterm. If you decide to give xterm any additional options, they must be before the -e; if you decide to give bash any additional options, they must be before the -c.
3. If your application is to run as anything other than root, instead of just running the application, you'll need to explicitly run it as the intended user. Since you're already root when you're running rc.local, you won't need to supply a password. Just use the sudo command:
Code:
sudo -u username /fullpath/application_name
4. Before the sudo command, you'll need to do things which login normally does for you. The two most obvious ones are cd'ing to the desired home directory, and setting environment variables. There are a whole bunch of them. It might be that not all of them are necessary, but some of the necessary ones might not be obvious. To see a list of ones which are set, log in to the same user who will be running the application (whether root or not), and
Use that as a guide for which environment variables to set in your script. If you don't know whether to include a particular environment variable, I recommend you throw it in there unless you know of a good reason not to.
5. If you do everything exactly as outlined above, you'll have yet another problem: you don't want to hang out in rc.local forever while the application is running; you want it to run to completion before the system comes up. In face, you'll probably want it to run to completion before you start your application.
To make sure that it doesn't wait around for your application to exit before rc.local continues (and eventually exits), place everything described above except the starting of kde in a separate script, and call that from rc.local as follows:
Code:
/etc/rc.d/rc.startmyapplication &
The ampersand at the end of that means that control will return to rc.local almost immediately, rather than waiting for your application to run and exit.
To make sure that rc.local is effectively finished before you run your application, place all of this (except possibly the startup of kde) at the very end of your rc.local.
Obviously, you should remember to make all your scripts executable:
Code:
chmod 700 /etc/rc.d/whateverscript
At any rate, I must compliment you on your choice of Linux distributions!
Hope this helps.