You are not logged in.

#1 2018-10-26 15:16:30

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 183
Website

[SOLVED] Adding terminal operations to menu.xml: Unable to find shell

Hi there guys!

I need to open a terminal window(that needs to stay open" and run a command in it to start a game server.  I keep getting the error "Unable to find shell" when I try it, however.

            <item label="Start Local Server">
                <action name="Execute">
                    <command>
                        <command>x-terminal-emulator -T 'Local FiveM Server' -e "cd /home/schwim/fivem/server-data && ../server/run.sh +exec server.cfg"</command>
                    </command>
                </action>
            </item>

I'm not sure what I'm doing wrong.  Could someone straighten me out?

Thanks for your time!

Last edited by schwim (2018-10-29 02:14:33)


Schw.im! A social site with an identity crisis.

Offline

#2 2018-10-26 17:13:11

damo
....moderator....
Registered: 2015-08-20
Posts: 4,382

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

You need to start a shell in x-terminal-emulator first, before shell commands will run. The general format is

x-terminal-emulator -e /bin/bash -c "<your command here>;bash"

The trailing "bash" keeps the terminal open, and you would need to escape any quotes in your commands.


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#3 2018-10-28 01:19:21

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 183
Website

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

Thanks for the help, Damo!

I tried but my double ampersand isn't registering, causing bash to think the whole line is the cd command.  How do I tell it that there are two separate commands?

x-terminal-emulator -e /bin/bash -c "\"cd /home/schwim/fivem/server-data && ../server/run.sh +exec server.cfg\";bash"

Schw.im! A social site with an identity crisis.

Offline

#4 2018-10-28 02:24:42

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 4,677
Website

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

I think you might have too much quoting there. Try:

x-terminal-emulator -e /bin/bash -c "cd /home/schwim/fivem/server-data && ../server/run.sh +exec server.cfg;bash"

John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#5 2018-10-28 02:28:14

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 183
Website

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

Hmm, with that in place, it just opens a terminal and no command prints to screen at all.

x-terminal-emulator -e /bin/bash -c "cd /home/schwim/fivem/server-data && ../server/run.sh +exec server.cfg;bash"

Schw.im! A social site with an identity crisis.

Offline

#6 2018-10-28 08:49:01

damo
....moderator....
Registered: 2015-08-20
Posts: 4,382

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

With multiple commands I put them in a script, then call that in menu.xml. That way you don't need to worry about escaping characters etc.


Be Excellent to Each Other...

FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#7 2018-10-28 09:40:14

ohnonot
...again
Registered: 2015-09-29
Posts: 3,197
Website

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

openbox' xml files do not like '&'.
i'm surprised you didn't get any errors after reconfiguring.
they need to be escaped like this: '&amp;'

here's an example of a fairly complex chain of commands that works in rc.xml:

<command>
dash -c 'wmctrl -l | grep -F "$(printf "0x%08x" "$(xdotool getwindowfocus)")" | grep Geany &amp;&amp; sleep 0.1 &amp;&amp; xdotool keyup Super_L Super_R key Alt_L+d t'
</command>

but it's definitely safer to simply put it in a script and call that instead.

Offline

#8 2018-10-29 02:10:14

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 4,677
Website

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

^A bonus of using a script is that you don't need to reconfigure openbox every time you change something.


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#9 2018-10-29 02:15:14

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 183
Website

Re: [SOLVED] Adding terminal operations to menu.xml: Unable to find shell

Thank you all so much for your help.  I just didn't think to use a script to handle this.  It worked fantastically.

Thanks again!


Schw.im! A social site with an identity crisis.

Offline

Board footer

Powered by FluxBB