run application on startup (raspberry PI)
-
I am study and trying with QT for device (I am very noob), the question is simple, it is possible to run my own application on raspberry startup? Thanks for your help I hope that i can help you too!
-
Hi Modonga,
the easiest way would be to add your program to
rc.local
in/etc
. -
hi dear! thanks for your fast reply, i got a few questions, when you say (rc.localin /etc.) you mean to rootfs/etc?, i am trying to paste the project there but i Cant, i press right click but the paste option is no enabled. How can I add my program to start in the boot?
My method is wrong?. Thanks! -
dear! i found the option:
Project > Run settings > Deployment "Make this application the default one". when i turn on my raspberry PI i have a small QT introduction and my application starts automatically, now, how i can do to turn on my application immediately when i turn on the raspberry pi (without QT introduction)? -
Normally you deploy your program to a folder say
/home/rpi/myprog
.
The file/etc/rc.local
is a bash script that is run on startup. So just add a
line to the bottom of this file pointing to your program.
See https://www.raspberrypi.org/documentation/linux/usage/rc-local.md for more information. -
no dear, i got in the raspberry the boot2QT i does not have that directory... ONLY way is "Make this application the default one" in Run settings. Regards!
-
i finally find that i was wanted for a long time is here:
http://doc.qt.io/QtForDeviceCreation/qtee-customization.html#booting-to-a-custom-application -
Include this header QSettings
#include <QSettings>
Add this into your code.
QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat); settings.setValue("YourApplicationName", QCoreApplication::applicationFilePath().replace('/', '\\'));
And when you want to disable startup`
settings.remove("YourApplicationName");
-