Only allow a single instance of the daemon?

60 views
Skip to first unread message

biagidp

unread,
Jun 30, 2011, 5:11:23 PM6/30/11
to Daemon Kit
I'm having a hard time figuring out how to determine if the daemon is
running before starting it up. I'm sure this isn't difficult, but my
searches have all returning nothing. If anyone that could point me to
the appropriate documentation I would greatly appreciate it.

Kenneth Kalmer

unread,
Jun 30, 2011, 7:36:05 PM6/30/11
to daemo...@googlegroups.com

Welcome to the list !

It is a bit late, excuse me if I miss the mark slightly.

When a daemon is running it will have a "pid file" located in the log/
directory, unless you specified a different path on starting it up. By
default it is called <daemon-name>.pid, where <daemon-name> is the
name of the project you generated. The contents of the file is just
the process ID (a number), and can be used to check whether the daemon
is indeed running.

daemon-kit currently provides no "locking" to ensure that only one
instance is running. If you need this kind of behavior we can ask the
list if they are OK with changing daemon-kit to fail if the PID file
exists (mongrel style), or we make this opt-in by passing a special
argument that enforces the behavior.

Kind regards

--
Kenneth Kalmer
kenneth...@gmail.com
http://opensourcery.co.za
@kennethkalmer

Marc Bowes

unread,
Jul 4, 2011, 3:58:11 AM7/4/11
to daemo...@googlegroups.com
IMO, there-shall-be-only-one is completely sane default behavior. Daemons, almost by definition, either are workers or servers of some sort and having multiple entities is often undesirable.


--
You received this message because you are subscribed to the Google Groups "Daemon Kit" group.
To post to this group, send email to daemo...@googlegroups.com.
To unsubscribe from this group, send email to daemon-kit+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/daemon-kit?hl=en.


Dan Healy

unread,
Jul 4, 2011, 5:26:57 AM7/4/11
to Daemon Kit
The only daemon-kit project I've written was designed for multiple
workers. I vote startup option.

--Dan



On Jul 4, 12:58 am, Marc Bowes <marcbo...@gmail.com> wrote:
> IMO, there-shall-be-only-one is completely sane default behavior. Daemons,
> almost by definition, either are workers or servers of some sort and having
> multiple entities is often undesirable.
>
> On Fri, Jul 1, 2011 at 1:36 AM, Kenneth Kalmer <kenneth.kal...@gmail.com>wrote:
>
>
>
>
>
>
>
> > On Thu, Jun 30, 2011 at 11:11 PM, biagidp <biag...@gmail.com> wrote:
> > > I'm having a hard time figuring out how to determine if the daemon is
> > > running before starting it up. I'm sure this isn't difficult, but my
> > > searches have all returning nothing. If anyone that could point me to
> > > the appropriate documentation I would greatly appreciate it.
>
> > Welcome to the list !
>
> > It is a bit late, excuse me if I miss the mark slightly.
>
> > When a daemon is running it will have a "pid file" located in the log/
> > directory, unless you specified a different path on starting it up. By
> > default it is called <daemon-name>.pid, where <daemon-name> is the
> > name of the project you generated. The contents of the file is just
> > the process ID (a number), and can be used to check whether the daemon
> > is indeed running.
>
> > daemon-kit currently provides no "locking" to ensure that only one
> > instance is running. If you need this kind of behavior we can ask the
> > list if they are OK with changing daemon-kit to fail if the PID file
> > exists (mongrel style), or we make this opt-in by passing a special
> > argument that enforces the behavior.
>
> > Kind regards
>
> > --
> > Kenneth Kalmer
> > kenneth.kal...@gmail.com

Tim Sjoberg

unread,
Jul 4, 2011, 5:37:37 AM7/4/11
to daemo...@googlegroups.com
If you're using the same pidfile you're doing it wrong? I vote single instance

Tim
Reply all
Reply to author
Forward
0 new messages