Starting .exe after boot


4 posts
by Blackbuster » Mon Jun 19, 2017 5:05 pm
Hello everyone!

Im trying to launch an application after my Raspberry PI 3B boots.

So I searched around the internet and found multiple options but i cant get one of them to work.
Okay so this is the case;

Ive got this executable file located at /home/pi/software/ddvsoft.exe and when i test it from terminal using:
Code: Select all
sudo mono /home/pi/software/ddvsoft.exe

it works perfect!

Now i want to start it right after the raspberry pi boots.
I tryed:

adding
Code: Select all
@mono /home/pi/software/ddvsoft.exe

and
Code: Select all
@sudo mono /home/pi/software/ddvsoft.exe

to /etc/xdg/lxsessions/LXDE-pi/autostart

and..

adding
Code: Select all
@mono /home/pi/software/ddvsoft.exe

and
Code: Select all
@sudo mono /home/pi/software/ddvsoft.exe

to /etc/xdg/lxsessions/LXDE/autostart

and..

adding
Code: Select all
mono /home/pi/software/ddvsoft.exe

and
Code: Select all
sudo mono /home/pi/software/ddvsoft.exe

to /etc/init.d/rc.local

and..

adding
Code: Select all
mono /home/pi/software/ddvsoft.exe

and
Code: Select all
sudo mono /home/pi/software/ddvsoft.exe

to /etc/rc.local

and last i tryed with crontab:

Code: Select all
@reboot sudo mono /home/pi/software/ddvsoft.exe


but all these solutions do not start the app after boot.
I hope someone can help me out!


Greetings,

Kevin
Posts: 3
Joined: Mon Jun 19, 2017 4:49 pm
by topguy » Mon Jun 19, 2017 10:22 pm
details that might be important..
- rc.local and cron is not run by the user Pi.
- if your program does not return or is spawned off in the background it might be killed by systemd.
- what if "mono" is not in the known PATH of the root user while booting. (use "which mono" to figure out where its hiding)

Since you say it runs well if you start it with sudo I would try (in rc.local)
Code: Select all
/usr/bin/mono /home/pi/software/ddvsoft.exe  > /home/pi/mylog.txt &


If this doesnt work, you might see an error in mylog.txt that tells you why it doesnt work, and if it does work you can remove the logging to file.

PS! if you .exe file is a GUI program then I guess you need to wait for the desktop to load.
User avatar
Posts: 3133
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway
by klricks » Mon Jun 19, 2017 11:24 pm
Blackbuster wrote:...
...

and..

adding
Code: Select all
@mono /home/pi/software/ddvsoft.exe

and
Code: Select all
@sudo mono /home/pi/software/ddvsoft.exe

to /etc/xdg/lxsessions/LXDE/autostart
.....


To start after desktop (GUI) loads, use this path: (Raspbian Jessie Pixel)
Code: Select all
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click web icon on right side --->
Posts: 4433
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
by Blackbuster » Tue Jun 20, 2017 11:16 am
If this doesnt work, you might see an error in mylog.txt that tells you why it doesnt work, and if it does work you can remove the logging to file.

PS! if you .exe file is a GUI program then I guess you need to wait for the desktop to load.


mylog.txt stays empty and yes its a GUI program!
To start after desktop (GUI) loads, use this path: (Raspbian Jessie Pixel)

Im using Jessie but the .config folder does not exist.

Thanks guys!
anoyone else?



#edit

Problem solved!

Its: sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart to start it!
Posts: 3
Joined: Mon Jun 19, 2017 4:49 pm