Start application from a inside a folder

Hi Guys,

Fairly simple to Linux users but to me.

I want to run a bin file from a folder. It can oly work while you are in that folder.

So use the command /home/user/Applications/furiusisomount-0.11.1.1/ && sh /home/user/Applications/furiusisomount-0.11.1.1/furiusisomount

That works perfectly from the console. But if i add that as a launcher it never works.

any ideas??

Thanks in advanced

You use sh so I would guess you guess the && is causing issues you should have little trouble also && is do unless previous fails. I also suspect this is a cd (Where you have command) this shouldn’t be needed sh /the/whole/path should work fine. Or add the shebang !#/bin/bash and change the execute bits then the sh shouldn’t be needed.

Also you maybe able to work around it by creating a sym link in ~/bin as this will be in your path after setting the exec bit.

Hey thanks for the reply. I didnt have to use sh /the/whole/filepath/ like you said. But the rest of your reply is kinda confusing. Can you clarify what you were saying a bit more for me please?

Plus how do i create that sym link?

I run the bin file for songbird. I basically clicked and dragged the bin file from the folder to the toolbar. This made a copy and it is working fine for me. I didn’t go through the hassle of manually creating a launcher for it.

Well the sym link shouldn’t really be necessary unless you use the terminal and want to use theappsname to call it like other cli apps.

If you did then you just need … OK just tested that this may depend on the data(It started but I’m missing bits) so the simple way would be to create a script. Put this in ~/bin and change it to execute use your favourite filemanager or chmod.

#!/bin/bash
./the/path/to/the/exe
# You can also do it as so, the above presumes the exe bit is set.. Then a filebrowser will be able to click it.
sh /the/to/the/exe

OT (Well now it is)
ln -s /the/path/to/the/exe /home/$user/bin/exe
This would create a sym link but depending on the exe may well not work if it needs the data folders.

Edit
The launcher should be easy to create now with out the cd && it should just start(Though getting rid of the sh and adding the shebang and adding the excute bit may make it work easier still), otherwise you can do as suggested an create a little launch script that may well make it easier still.

Well, it just doesnt’ start. This binary file needs the data files associated with it to start

Now FeatherMonkey. I tried to create the script trying to do exactly what you told me.

Still no luck. But i most likely am doing something wrong. This is how my script looks like:

#!/bin/bash
./home/sebastien/Applications/furiusisomount-0.11.1.1/

You can also do it as so, the above presumes the exe bit is set… Then a filebrowser will be able to click it.

sh /home/sebastien/Applications/furiusisomount-0.11.1.1/furiousmount

is this correct. I’ve used chmod 755 settings on the file

I get this error when i run it:

/bin/Test: line 2: ./home/sebastien/Applications/furiusisomount-0.11.1.1/: No such file or directory
sh: /home/sebastien/Applications/furiusisomount-0.11.1.1/furiousmount: No such file or directory

LOL

I know the mistake. I spelt it wrong. I got the script to run. THANK YOU. Now to make it a shortcut…

Glad you’re sorting it, still surprised you couldn’t just create the shortcut/launcher with one of the commands(They both do the same)

sh is as you did it, this is normally done if the execute bit isn’t set i.e clicking in browser doesn’t launch it. If the execute bit is set and it still doesn’t launch then it’ll need the shebang line first line in the script #!/bin/bash. Then the first line will work which is ./the/script.

Then further in using bin makes it unnecessary to use ./the/script so really we have the 3 different ways of running

./the/script = run this script needs the shebang line and execute bit note the fullstop at the beginning

sh /the/script = use sh to execute the/script

script = where it would be in the bin or specifically $PATH (Like . needs the shebang and execute bit)
As ~/bin is in the users path, you can also do things like adding to your default path but some thought needs to be taken. I tend to think of it as a last resort and wouldn’t actually amend my $PATH unless nothing else worked.

Yea, i just used the “command” that I put in the bin folder as the launcher and it worked perfectly.

I’m wondering though, I have a linux server that I have to keep starting a service manually. how can I write the script that allows me to run a a command as a specific user while still having to use a specific directory to a file from another directory?

Mmm going to need a proper guru …

As for the bits of a data folder I see 2 ways I had the same problem I have a game installed in ~ so threw my off the cuff statement about ln -s which didn’t work…

Now I can create the link fine but unless I goto the data folder it won’t work so it would involve a script to cd to the folder then execute.

The better way would be if the app can actually take a --data folder flag then you could just call it that would depend on the app.

Now the troublesome bit is the start as another user, here I would look at sudo I suspect you maybe able to configure it to run as user x, but most of the time it as root, but I do remember the sudoers gui having lots of other bits. Now hopefully that lot works and you can just use sudo /the/command and it’ll run as the user you specify if not… Well that creates a big security hole for me, you need to get around using the user password and using su user first. To get around it and I do not recommend it you would need to look at things like the expect module which you’ll find for a variety of languages.

yea thanks for the help. You see its suppose to be a startup script. I cannot use root to start the application.

Hopefully oldcpu or the rest of guys could help out.

You’re missing it sudo isn’t just runas root Sudoers Manual yes I’ve just pointed you to the man page my suse has died again, I know the gui gives you the option the example sudoers http://www.courtesan.com/sudo/sample.sudoers This has a very complicated example of a group that run as www or can su to www.