An idea! was...Re: [K12OSN] opening too many programs blanks screen K12LTSP
Darryl Palmer
dpalmerjr at gmail.com
Fri Oct 27 19:41:53 UTC 2006
On 10/27/06, David Trask <dtrask at vcsvikings.org> wrote:
>
> How could one write a script that could then become a launcher or menu
> item that would poll the system to see if that program was already running
> under the logged on user....if not....then launch the program....if
> yes....then abort. This might make it easier to keep kids from going
> "click happy" and opening multiple instances of a program. Any ideas?
>
You can use lockfile to do this, you can write something like
#! /bin/bash
#Check to see if the lockfile exits
if lockfile -! -r 0 ~/.locks/lockfile-firefox; then
echo "Unable to start firefox, lock file exists"
exit 1
fi
firefox
rm -f ~/.locks/lockfile-firefox
You need to create a .locks subdirectory for each user, then you can erase
all the locks at once. You can also stick them in the temporary directory
instead.
Darryl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/k12osn/attachments/20061027/90f311b9/attachment.htm>
More information about the K12OSN
mailing list