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.
|