run application on startup Raspbian RPI3B+
-
Well, first of all I would like to say that the application I created works great, it is a counter for the car. I'm starting it right after the start of the RPI. It takes 10 seconds but this is not my problem ...
The application is started using the init / systemd service ... and the service runs the script
Start.sh#!/bin/bash echo "Starting..." ip link set can0 type can bitrate 100000 ifconfig can0 up /home/pi/cluster -platform linuxfb
After running the script, the CAN interface is switched on and then the application. Unfortunately, when you run it, there are terrible lags, I do not know what's happening ... When I run this script using the console or ssh everything works great, so as you can guess the problem is incorrect initialization.
Does anyone have other tried and tested ways to run the GUI application after the rpi startup and make it work as it should ?? -
Hi,
From old memories, you have to ensure that you start your application at the right level / order so that your system is sufficiently initialised.
-
Hi,
From old memories, you have to ensure that you start your application at the right level / order so that your system is sufficiently initialised.
@SGaist
Thank You for answer :)
I think you have right.. When i tried to run aplication by bashrc and after loading desktop of raspbian and sign in by ssh, my instrument cluster was running curectly with no lags.
So where I must to start search best solution ? When i run my qt app by init/systemd (service) or rc.local, my app starting before load desktop with lags.
I thinking about other idea like create console application that will start working before loading the desktop, then wait a few seconds and run my shell script that will launch the can interface and my counter, is it good idea? -
Why are you loading the desktop environment of your RPi since you have an application that uses the frame buffer ?
-
Why are you loading the desktop environment of your RPi since you have an application that uses the frame buffer ?
@SGaist
All the time I thought I needed some graphic libraries that are loaded with the desktop. So how to do it? Should I stop running X server from local.rc and run my application directly?
@edit
When I loaded my application using serverX ---> xinitrc ... my application started, but it does not get anything from the CAN interface ...
xinitrc:#!/bin/sh # /etc/X11/xinit/xinitrc # # global xinitrc file, used by all X sessions started by xinit (startx) #~pi/.xinitrc sudo modprobe can_dev sudo modprobe gs_usb sudo modprobe can sudo modprobe slcan /usr/bin/start.sh # invoke global X session script . /etc/X11/Xsession
#!/bin/bash sleep 5 ip link set can0 type can bitrate 100000 ifconfig can0 up /home/pi/Desktop/nienazwany -platform xcb
-
That's likely because your user doesn't have the proper rights to access the device. You should check which group it should belong to for that.
Next, you should use Linux setup facilities to load the modules you need. .xinitrc is not the right place for that.
Same goes for the network setup. You should again use your distribution network setup capabilities / configuration management.
-
I start my application also with systemd and have no problems. However, I use eglfs, and not xserver (which is probably what you should do too: https://wiki.qt.io/RaspberryPi2EGLFS