Gnome Terminal

David Mackintosh David.Mackintosh at xdroop.com
Sat Jun 5 19:32:46 UTC 2004


On Sat, Jun 05, 2004 at 11:47:32AM +0530, sg at pobox.com wrote:
> Sir,
> 
> I am having RedHat Linux 9.0 and i have a application which is run in 
> Gnome-Terminal and i have create a shortcut for that application on GNOME 
> Desktop.
> 
> My problem is that if a user press ENTER key 10 or 20 times then this 
> application run in 10 or 20 times.
> 
> I want if this application run one time then it will not excute when a user 
> press ENTER key again.

Do you want it to only have one running instance at a time, or do you want
it to run once and then never run again?

If the former, create yourself a little launcher script like this:

---BEGIN
#!/bin/bash

MYAPP='sleep'
MYAPPPATH='/bin'
MYPARAMETERS=20

if [ ! -f ~/.${MYAPP}.lock ] ; then
    touch ~/.${MYAPP}.lock
    $MYAPPPATH/$MYAPP $MYPARAMETERS
    rm ~/.${MYAPP}.lock
else
    echo $MYAPP is already running
fi
---END

If the latter, remove the 'rm' line, and edit the 'echo' line to say
something like $MYAPP cannot be re-run again... but if that is the
case I don't really understand why you are making an icon for the
application.

Change the value of MYAPP, MYAPPPATH, and MYPARAMETERS as
appropriate.  Now set the icon on your desktop to be aimed at the
launcher script.  

Note that this won't work with some programs which detatch from the
calling command interpreter, but it should work with mosth things.

Also note that if you have a system crash while $MYAPP is running,
you will need to manually remove ~/.${MYAPP} before it $MYAPP will
run again.  

-- 
 /\oo/\
/ /()\ \ David Mackintosh | 





More information about the Redhat-install-list mailing list