LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   creating useful launchers (https://www.linuxquestions.org/questions/linux-newbie-8/creating-useful-launchers-549655/)

dhaus111 04-28-2007 02:22 AM

creating useful launchers
 
Hey all,

I'm trying to figure out how to make scripts or launchers do my bidding.
basically I'd like to have an icon i can click on to run commands or more specifically lists of commands. most of these would require sudo privileges. One of the things I'd like to do is have a button "turn on" another X server which would use ssh and the -X switch to login to an X server on another computer on my LAN.

currently what I have to do to accomplish this is:

switch to tty2 and:
Code:

X :1
now this renders this tty stuck running 2nd x server

switch to tty1 and:
Code:

xterm -display :1
this opens up a terminal in the x server for me to execute the next command

Code:

ssh -X myuser@192.168.1.5
and then:
Code:

gnome-session
This sets up a fully functional remote gnome session on my 2nd xserver, which is pretty nice. There are probably better ways to do this, but this is what I figured out, any improvements would be appreciated.

now for the purpose of this post, I'd like to know how to automate this into a single click of a script or launcher of sorts. Is this possible? how would I configure my local gnome session to prompt me for passwords the way everything else does (with the pretty little password dialog).

Thanks for reading, and hopefully posting...

PatrickNew 04-29-2007 11:11 AM

Well, you can make a simple sh script. Basically, all you do is list the commands you want to execute in a file since you say you're using Gnome, I'll assume you have gksduo or gksu, the programs that do the password asking. To figure out which you have, open a terminal, type them in, and see which doesn't complain about not existing.

Then, with the passwords, your script should look kinda like this:
Code:

gksu firstCommand && secondCommand && thirdComand
---OR IF YOU HAVE GKSUDO---
gksudo firstCommand && secondCommand && thirdComand

Then, you can just add a normal launcher to the gnome toolbar, and where it asks for the executable location, pass it your script


All times are GMT -5. The time now is 12:39 AM.