LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-24-2009, 07:57 AM   #1
skipidar
LQ Newbie
 
Registered: Jun 2009
Posts: 15

Rep: Reputation: 0
Desktop Launcher of shell-script in gnome-terminal


Hello everybody,

my problem is quite simple:

i want to have a launcher of a command: "grub-reboot 4"
on my desktop.





But this little problem brought me into hell.


1. First i tried to create a launcher with

"gnome-terminal -e 'grub-reboot 4'"

Error: nothing happens....


2. Then is created a shellscript

#! /bin/sh"
grub-reboot 4

and made it executable with "chmod a+x script.sh"
gave permissions with "chmod 777"

Tried to start it from terminal, it works with
"sh script.sh"
"./script.sh"
but only with root right, otherwise it tells that command doesn's exist!


2.1 Tried to launch the shell-script so that it's output appears in
terminal.

"/bin/sh /home..../script.sh "
"gnome-terminal -e /home..../script.sh"
"gnome-terminal -x /home..../script.sh"

Didn't produce any output, or noncence like


which message don't make any sence for me,
because it appears, when the scipt doesn't exists, or i dont have the rights to execute the script or.....


2.2 When i found out, that this message:
"There was an error creating the child process for this terminal" appears, when i have no rights to execute a script,
i tried to create a Launcher with

"gksudo /home..../script.sh"

Which started the Terminal, as i wanted,
showed the script output,

AND
appended something like
"scanning for DEVICES, i will need a while for that , lalala"

2.3

At least i created a Launcher with

"sudo /home..../script.sh"

which was the correct way, and gave me my output in terminal.






Conclusion:

Job: execute root command in terminal, showin it's output in terminal


Solution:
1. create a shell script "scriptname.sh", which includes #! /bin/sh" in the row 1,
and all commands then, which you want to execute

2. make file executable with command "chmod a+x scriptname.sh"
3. set permissions of this script with "chmod 777 scriptname.sh"

4. create a launcher, pointing directrly to the script:

"sudo /home..../scriptname.sh" if root right are required for execution
"/home..../scriptname.sh" else.






Question to the Profis:

Is there a way to get better Error output in Linux?
If the System would clearly point out, that the problem is in the
missing scriptfile or missing rights,
this could be solved in 2 min, i needed 3 hours for that,

Linux will never rule the world, until the usability and clear user<->pc communication wont be present in it.
 
Old 06-24-2009, 09:27 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
When you execute a command with gnome-terminal -e, all the output of that command goes to the newly created terminal. this is the point in launching something with gnome-terminal. Once the command has terminated, the gnome-terminal is closed. In your case, the error is displayed in gnome-terminal and the gnome-terminal is immediately terminated.
This is exactly what I expect from gnome-terminal. If you want to see the errors in your script, you should either redirect the output to somewhere or not launch it in a specifically created gnome-terminal or you should make sure your script does not stop after an error. The point of using gnome-terminal to launch your script is that all the output goes to that terminal.

Anyway, I understand how frustrating something must be when you don't understand it. I just spent 3 days trying to figure out why my damn SQL server didn't open the damn port on my Windows machine. It turns out the error was burried in the event dialog in the administrative stuff of system settings. Very very frustrating when you don't know where to look for an error and the system does not do what you expect it to do. I guess Windows will never rule the world either.

Last edited by Agrouf; 06-24-2009 at 09:30 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gnome launcher for intellij shell script loopyzort Linux - Software 1 08-24-2009 12:46 PM
allow tabbing in gnome-terminal shell script texasone Linux - Desktop 1 08-14-2008 11:23 PM
Running a command from a launcher (on gnome desktop) Virtuality Linux - Newbie 1 12-17-2007 08:32 AM
New Launcher in Gnome doesn't appear on the desktop baltho Linux - Software 2 03-28-2005 09:46 PM
gnome-terminal launcher script Mur Linux - Software 0 04-26-2004 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration