• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2455
  • Last Modified:

Run script from RedHat Linux RHEL5 desktop in GNOME

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?
0
bfilipek
Asked:
bfilipek
2 Solutions
 
http:// thevpn.guruCommented:
Are you running them as the same user in bash and in Gnome ? I.e. are you running them as root in bash ?
0
 
SeanGeekWalterCommented:
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
0
 
Pétur Ingi EgilssonSoftware Engineer -- ConsultantCommented:
#!/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`
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now