Re: how can I make sure only one instance of gkrellm runs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2008-10-17 at 12:56 +1100, Cameron Simpson wrote:
> On 16Oct2008 18:38, Patrick O'Callaghan <pocallaghan@xxxxxxxxx> wrote:
> | 2) What does "kill -0" do? "man kill" doesn't mention this possibilty.
> 
> It is the standard way of probing for a process given a pid.
> It does everything any other signal does except get delivered to the
> process (the process never sees it).
> There are three outcomes for the caller:
>   success:
>     the process exists
>   failure:
>     no such process: the process does not exist
>     permission denied: the process exists, but you don't own it
> 
> You're looking at the wrong man page, BTW.
> 
> "man 3p kill" says:
> 
>   The kill() function shall send a signal to a process or a group of
>   processes  specified by pid. The signal to be sent is specified by sig and
>   is either one from the list given in <signal.h> or 0. If sig is 0 (the null
>   signal),  error  checking  is performed but no signal is actually sent. The
>   null signal can be used to check the validity of pid.
> 
> "man 2 kill" says:
> 
>   If sig is 0, then no signal is sent, but error checking is  still
>   performed.
> 
> This behaviour dates from at least V7 UNIX (1970s) and probly earlier.

Yes, I used to know that 30 years ago but had forgotten it. Which is why
I looked at the man page. Not the "wrong" man page but the man page for
the "kill" command. The fact that there's another man page for the
"kill()" system call and yet another for the "kill()" POSIX library
function is beside the point, since the script is executing the command
and not the syscall or library function. In fact the "help kill" text
for the shell builtin doesn't mention this possibility either, i.e. we
have a documentation bug.

> | 3) The script has an obvious race condition, (i.e. if run from several
> | places simultaneously, there is a non-zero probability of starting more
> | than one process). This is because running the process and creating the
> | pidfile are two separate actions.
> 
> Absolutely; I may even have mentioned this when I posted the script for
> this user some months ago. But for a single person running a single GUI
> it may serve. There are better ways, without races, but they are a bit
> more cumbersome to script and to understand.

I'm pretty sure I saw a package announced recently which could possibly
be useful in this situation. It would either execute a program or signal
it if it was already running. Wish I could remember the name of the
thing.

poc

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux