Go Back   Velocity Reviews > Newsgroups > Python
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

Python - Re: Queryable Daemon

 
Thread Tools Search this Thread
Old 08-01-2009, 08:32 PM   #1
Default Re: Queryable Daemon


Justin DeCell wrote:
> Hi All,
>
> I was hoping for a little help with a project I'm working on. I'm
> writing a daemon in python that I want to be queryable (i.e. I should
> be able to run foo -s and it will report some internal information about
> the foo daemon if it's running) but I can't figure out a way get
> information from that process from an external process. I was thinking
> that there should be a way to open a file descriptor, have the daemon
> write to that every so often and then have the query process just read
> from that fd but it looks like on the process reading from an fd has to
> be a child of the daemon for this to work. The only other way I thought
> of would be to write to a file on disk every so often from the daemon
> and just read the from the query process but it seems like there should
> be a more elegant way to do this...
>
> By the way I'm writing this for unix only so there's no need to worry
> about compatibility with other os'.
>

Instead of a file descriptor, how about a socket? A certain port at
"127.0.0.1"?


MRAB
  Reply With Quote
Old 08-01-2009, 10:14 PM   #2
garabik-news-2005-05@kassiopeia.juls.savba.sk
 
Posts: n/a
Default Re: Queryable Daemon
MRAB <> wrote:
> Justin DeCell wrote:
>> Hi All,
>>


....

>> The only other way I thought
>> of would be to write to a file on disk every so often from the daemon
>> and just read the from the query process but it seems like there should
>> be a more elegant way to do this...
>>
>> By the way I'm writing this for unix only so there's no need to worry
>> about compatibility with other os'.
>>

> Instead of a file descriptor, how about a socket? A certain port at
> "127.0.0.1"?


Or a Unix domain socket.

Or let the demon catch signal, say SIGUSR1 and dump its state to a file.
A bit easier programming that a socket, a bit less elegant.

--
-----------------------------------------------------------
| Radovan GarabĂ*k http://kassiopeia.juls.savba.sk/~garabik/ |
| __..--^^^--..__ garabik @ kassiopeia.juls.savba.sk |
-----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!


garabik-news-2005-05@kassiopeia.juls.savba.sk
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46