Page 1 of 1

BASH

Posted: Tue Jan 31, 2017 5:40 pm
by faramon
Hi, one question for BASH call...

In my post about mission planner I ask a question but theme is not in that scope I think...
My exe is installed and works.
It is in directory:
/home/pi/workspace
It can be started from same directory:
cd /home/pi/workspace
and then:
sudo mono MissionPlanner.exe

but, how to start at boot or restart from bash with calling through directory?
What to put into desktop file that I have in Exec call, can this works?:
/home/pi/.config/autostart/autostart.desktop
This if desktop file:

Code: Select all

[Desktop Entry]
Type=Application
Name=MissionPlanner
Exec=sudo /home/pi/workspace mono MissionPlanner.exe
StartupNotify=false
I ask because it seems that it does not work...
Thanx,
Faramon

Re: BASH

Posted: Tue Jan 31, 2017 6:32 pm
by Paeryn
I think you can set the working directory that the program has by adding to your .desktop file

Code: Select all

Path=/home/pi/workspace

Re: BASH

Posted: Wed Feb 01, 2017 8:31 am
by faramon
Ok, but is there something special to position in this directory from BASH?

Can I put something like:

Code: Select all

Path=/home/pi/workspace
Exec=sudo mono Path/MissionPlanner.exe
will this work? I have somewhere Node.js application that is started the same way, I will testing with it when I found it on my second Raspberry Pi...

Re: BASH

Posted: Wed Feb 01, 2017 8:52 am
by Paeryn
faramon wrote:Ok, but is there something special to position in this directory from BASH?

Can I put something like:

Code: Select all

Path=/home/pi/workspace
Exec=sudo mono Path/MissionPlanner.exe
will this work? I have somewhere Node.js application that is started the same way, I will testing with it when I found it on my second Raspberry Pi...
The Path= line sets the working directory (i.e. the directory from which the application will be run).

Code: Select all

Path=/home/pi/workspace
Exec=sudo mono MissionPlanner.exe
Or

Code: Select all

Path=/home/pi/workspace
Exec=sudo mono /home/pi/workspace/MissionPlanner.exe
Bash isn't relevant here, you are running an executable directly from the desktop process, Bash isn't running it.

Re: BASH

Posted: Wed Feb 01, 2017 8:52 am
by DougieLawson
Stop using sudo. You don't need sudo for everything.

Re: BASH

Posted: Wed Feb 01, 2017 8:56 am
by faramon
Thanx Paeryn I will try this...

And Dougie, yes, I always try first without sudo and last with sudo...