All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: linux-c-programming@vger.kernel.org
Subject: Re: a 'wrapper'
Date: Sat, 29 Jun 2002 16:49:08 +0200	[thread overview]
Message-ID: <20020629144908.GU17216@lug-owl.de> (raw)
In-Reply-To: <20020629052348.A50622@nietzsche>

[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]

On Sat, 2002-06-29 05:25:02 -0500, xlp <xlp@emtel.net.co>
wrote in message <20020629052348.A50622@nietzsche>:
> hi, i have been trying to let certain process working on a remote machine in this way:
> nohup ./a.out >> /dev/null &
> but when i log off, the process dies.
> Can i code a certain process that fork itself, call setsid() and run a.out with system() or exec() ?
> How can i deal with this situation? I want that the executable object a.out forget about terminal control and do its work without care about sdtin/stdout/stderr.

You should never ever use system(), is's insecure. Use exec*(). However,
you won't need that - try this:

	nohup ./a.out > /dev/null 2>&1 < /dev/null &

It probably dies because of a SIGPIPE if it attempts to read something
from stdin or if it tries to write to stdout. You break this file
descriptors in the moment you log off...

MfG, JBG

-- 
Jan-Benedict Glaw   .   jbglaw@lug-owl.de   .   +49-172-7608481
	 -- New APT-Proxy written in shell script --
	   http://lug-owl.de/~jbglaw/software/ap2/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2002-06-29 14:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-29 10:25 a 'wrapper' xlp
2002-06-29 14:49 ` Jan-Benedict Glaw [this message]
2002-06-30  7:52   ` Ben Marsh

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=20020629144908.GU17216@lug-owl.de \
    --to=jbglaw@lug-owl.de \
    --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.