We help IT Professionals succeed at work.

Run script from RedHat Linux RHEL5 desktop in GNOME

bfilipek
bfilipek asked
on
I have a few scripts in my /home/myname directory that run executable files located elsewhere on my server. Here are the files:

/home/myname/PGM1
/home/myname/PGM2
/home/myname/PGM3

The contents of these files are basically a script that look like this (this example from PGM1):

cd /data/program
./run /data/PGM1

I need these 3 scripts to run in a terminal on my GNOME desktop. So what I do is log into the console, open a terminal, and type ./PGM1. This then runs the script in a terminal window which stays on the screen. I repeat this step for all 3 scripts.

What I want to do is have a shortcut to these scripts on my GNOME desktop that I can just double click on. So I created the short cuts, but when I try to open them, nothing happens. I've tried right-clicking them and selecting "Open with> /bin/bash" and also "Open with> terminal" with no luck. Any thoughts?
Comment
Watch Question

Top Expert 2008

Commented:
Are you running them as the same user in bash and in Gnome ? I.e. are you running them as root in bash ?
You can also right-click on the menu, and press "Edit Menus". Then you can add a menu item to do it rather than a desktop icon. If you need to run them as root then use gksu in place of sudo to pring up the gui password prompt. i.e. gksu /data/program/run /data/PGM1
PĂ©tur Ingi EgilssonSoftware Engineer -- Consultant
Commented:
#!/bin/bash
/data/program/data/PGM1

save the file as /home/yourname/bin/PGM1.sh
chmod +x /home/yourname/bin/PGM1.sh

#make sure ~/bin is in your path
echo $PATH
#if ~/bin is not in your path, add this line to ~/.bash_profile
PATH=$PATH:/data/myscripts
export PATH

create a gnome shortcut "to a command", the comand should be `PGM1.sh`
Forced accept.

Computer101
EE Admin

Explore More ContentExplore courses, solutions, and other research materials related to this topic.