All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sindunata <software@dygsp.com>
To: linux-c-programming@vger.kernel.org
Subject: simple daemon dies
Date: Wed, 29 May 2002 15:39:38 +0700	[thread overview]
Message-ID: <20020529153938.A4699@top4> (raw)

Hi all,

I'm trying to write a simple daemon background process.
It connects to PostgreSQL and wait for a notify event and upon receiving
some event will invoke some URL using curl library.

I got it working already if I run it in foreground. But if I put the
process in background (using &), and then after sometime the process
will die. I think there's some signal that I need to catch, can
someone please help me?

Currently i'm trapping the following signals:

  struct sigaction act;
  
  /* set signal handler TERM (terminate by kill) & INT (keyboard break) to exit nicely */
  act.sa_flags = 0;
  act.sa_handler = mainExit;
  sigemptyset (&(act.sa_mask));
  
  sigaction (SIGTERM, &act, NULL);
  sigaction (SIGINT, &act, NULL);

  /* ignore SIGHUP  & SIGTTOU */
  act.sa_handler = SIG_IGN;
  sigaction(SIGHUP, &act, NULL);
  sigaction(SIGTTOU, &act, NULL);

TIA & regards,
Sindu

             reply	other threads:[~2002-05-29  8:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-29  8:39 Sindunata [this message]
2002-05-29  9:29 ` simple daemon dies Glynn Clements
2002-05-30  2:16   ` Sindunata
2002-05-30  5:24     ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020529153938.A4699@top4 \
    --to=software@dygsp.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.