Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#3206 closed Enhancement (fixed)

Add pidfile support

Reported by: bramswenson Owned by: charles
Priority: Normal Milestone: 2.00
Component: Daemon Version: 1.93
Severity: Normal Keywords: pidfile pid daemon
Cc:

Description

Current versions of T daemon do not write the processes PID to a file, and do not have this as an option. This is a big issue when trying to run and manage multiple T instances one the same server. It takes some ps hackery to get the proper PID for each instance. In order to even stop 1 instance of 2 one needs to find the PID somehow and issue a signal.

Please add pidfile support. Or put it back rather, since it did work once.

Change History (7)

comment:1 Changed 13 years ago by charles

Hey Bram,

What's the use case for this? Once you get the pid, what do you have in mind to do with it?

comment:2 Changed 13 years ago by bramswenson

Charles, thanks for the quick response. I feel there are many use cases for this.

  • Sending kill (HUP|KILL|etc) signals to the proper instance when more than one instance is running
  • External access to process status when there is more than 1 instance of the daemon running
  • External access to process performance data when there is more than 1 instance of the daemon running
  • Enabling easy use of procfs (easiest to navigate with a pid available)

Almost all of the use cases I have in mind are related to running more than one instance of T daemon on the same box (ie multiple user accounts each running T).

comment:3 Changed 13 years ago by bramswenson

http://gist.github.com/405463

I had a friend with some C experience take a shot at it to be sure it could be done. That patch seems to work ok. Were not sure if its in proper shape for submitting as a real patch though. It also brings up the fact daemon.c has code for a few types of forking, and I never mentioned that my env is Ubuntu Linux and related. So thats where this patch works. Maybe this stuff should be wrapped in ifdef's to only include the option for forking types that support this.

Thanks in advance for any help on this. Its pretty simple stuff and extremely useful when T needs to be running more than once on the same box. Not to mention it cleans up the init scripts a bit as well.

comment:4 Changed 13 years ago by charles

  • Milestone changed from None Set to 2.00
  • Owner set to charles
  • Status changed from new to assigned
  • Summary changed from Cannot Run/Manage Multiple Instances Sanely to Add pidfile support
  • Type changed from Bug to Enhancement

Added to trunk for 2.00 in r10655

comment:5 Changed 13 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:6 Changed 13 years ago by bramswenson

Thanks T team! And mgm, you know who you are, for the initial patch.

comment:7 Changed 13 years ago by bramswenson

I have back ported this patch 1.92 and will backport to 1.93 shortly.

1.92 back port - http://gist.github.com/408798

Note: See TracTickets for help on using tickets.