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 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.

| 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.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

It's as if all of Scottish cuisine is based on a dare.  - Saturday Night Live

-- 
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