if an application itself does not include a way to do this you could always write a shell wrapper for it which would check for a running instance of the application and either launch or fail based on whether or not it found a running instance. To do this you could use the output of a 'ps -ef | grep ' command. obviously, You would need to know what the ps -ef output is for the application. To make it transparent, you could give the wrapper the same name as the executable and put it in /usr/local/bin and then put /usr/local/bin ahead of the other executable directories in your path; usually /usr/bin.
the following might get you started for a wrapper for firefox. Mind you, it is untested.
Code:
cygnus:davidj tmp > cat firefox
#!/bin/bash
ps -ef | grep -v grep | grep firefox > /dev/null
if [ "$?" -eq "1" ]; then
/usr/bin/firefox &
else
echo "firefox is already running"
fi
make the script executable, put it in /usr/local/bin.
Code:
cygnus:davidj tmp > cd /usr/local/bin
cygnus:davidj bin > sudo chmod a+x firefox
cygnus:davidj bin > ls -l firefox
-rwxr-xr-x 1 root root 157 2007-12-29 12:09 firefox
also make sure /usr/local/bin is before /usr/bin in your path: something like this:
Code:
cygnus:davidj tmp > echo $PATH
/bin:/usr/local/bin:/usr/bin:/usr/bin/X11:/usr/games/bin:/usr/X11R6
then when people launch firefox, the script in /usr/local/bin will be found before the executable in /usr/bin.
hope this helps,
davidj