Xfce Forum

Sub domains
 

You are not logged in.

#1 2020-07-13 20:15:42

fudilt
Member
Registered: 2020-06-22
Posts: 11

Launcher crash trying to execute a command

Hi everyone,
I'm running XFCE 4.12 on Debian 10.
I want to create a launcher that execute the following command in the terminal:

xfce4-terminal --command "watch -n 1.0 sudo nvidia-smi" && sudo /home/patrick/Scripts/nmonLauncher.sh

Where /home/patrick/Scripts/nmonLauncher.sh contains:

su
export NMON=Mmcdt-
nmon

Running this in the terminal gives the correct output (two windows with nmon and smi), but when i set a launcher to do this, it opens a terminal and suddenly close it.
I have the permission to run the script and nvidia-smi with sudo without password
Maybe I'm missing something.

Offline

#2 2020-07-13 20:53:12

MrEen
Member
Registered: 2019-04-19
Posts: 295

Re: Launcher crash trying to execute a command

Try this as the launcher command:

bash -c "xfce4-terminal --command "watch -n 1.0 sudo nvidia-smi" && sudo /home/patrick/Scripts/nmonLauncher.sh"

Offline

#3 2020-07-13 21:52:19

fudilt
Member
Registered: 2020-06-22
Posts: 11

Re: Launcher crash trying to execute a command

MrEen wrote:

Try this as the launcher command:

bash -c "xfce4-terminal --command "watch -n 1.0 sudo nvidia-smi" && sudo /home/patrick/Scripts/nmonLauncher.sh"

Arleady tried, same result

Offline

#4 2020-07-13 21:55:06

MrEen
Member
Registered: 2019-04-19
Posts: 295

Re: Launcher crash trying to execute a command

I'll bet it's the quoting in the line causing an issue, but that's a little over my head.

Offline

#5 2020-07-13 22:20:50

eriefisher
Member
From: ON, Canada
Registered: 2008-10-25
Posts: 414

Re: Launcher crash trying to execute a command

Assuming the command shown above works as written(no way to test here) then it's best to format it into a script. If the script works then use the launcher to call the script. As I understand it the interpreter is limited so trying to do too much could overwhelm it. Calling the script instead takes the load off.


Siduction
Debian Sid
Xfce 4.18

Offline

#6 2020-07-13 23:20:22

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,022

Re: Launcher crash trying to execute a command

You can pass xfce4-terminal the "-H" parameter to hold the screen so you can see the message.

But more importantly, how are dealing with the sudo command and the su in the script? How do you enter the password?


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2020-07-13 23:44:40

fudilt
Member
Registered: 2020-06-22
Posts: 11

Re: Launcher crash trying to execute a command

eriefisher wrote:

Assuming the command shown above works as written(no way to test here) then it's best to format it into a script. If the script works then use the launcher to call the script. As I understand it the interpreter is limited so trying to do too much could overwhelm it. Calling the script instead takes the load off.

It's correct since it works in the terminal but not in the launcher. I tried to make a script but i get no such file or directory on /usr/bin/xfce4-terminal

Offline

#8 2020-07-13 23:45:55

fudilt
Member
Registered: 2020-06-22
Posts: 11

Re: Launcher crash trying to execute a command

ToZ wrote:

You can pass xfce4-terminal the "-H" parameter to hold the screen so you can see the message.

But more importantly, how are dealing with the sudo command and the su in the script? How do you enter the password?

That parameter had no effects. I don't need to insert the passwords since I have the permission to do so on nvidia-smi and the script

Offline

#9 2020-07-14 00:53:28

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,022

Re: Launcher crash trying to execute a command

fudilt wrote:

That parameter had no effects.

That's odd. Try these examples as launcher commands:

bash -c "xfce4-terminal --command 'ls -l'"

...a window should pop up quickly and then disappear.

bash -c "xfce4-terminal -H --command 'ls -l'"

...a window shout pop up and stay open until you manually close it. If there was an error message, you would see it.

Then try this as your command:

bash -c "xfce4-terminal -H --command 'watch -n 1.0 sudo nvidia-smi' && sudo /home/patrick/Scripts/nmonLauncher.sh"

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#10 2020-07-14 01:40:18

fudilt
Member
Registered: 2020-06-22
Posts: 11

Re: Launcher crash trying to execute a command

ToZ wrote:

That's odd.

Yeah, I think i wrote it wrong.

ToZ wrote:

try this as your command:

bash -c "xfce4-terminal -H --command 'watch -n 1.0 sudo nvidia-smi' && sudo /home/patrick/Scripts/nmonLauncher.sh"

This worked, thanks you a lot. The problem was double quotes.

Offline

Board footer

Powered by FluxBB