Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2001 23:48:20 -0800
From:      "Crist J. Clark" <cjclark@reflexnet.net>
To:        Christopher Farley <chris@northernbrewer.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Detatch process from terminal?
Message-ID:  <20010115234820.M97980@rfx-64-6-211-149.users.reflexco>
In-Reply-To: <20010116005127.A31629@northernbrewer.com>; from chris@northernbrewer.com on Tue, Jan 16, 2001 at 12:51:27AM -0600
References:  <20010116005127.A31629@northernbrewer.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 16, 2001 at 12:51:27AM -0600, Christopher Farley wrote:
> Hopefully a simple question:
> 
> Some processes can be launched from an shell, such as vim (and I presume
> emacs) so that PID 1 (init) is the parent of the process, and not the
> shell that launches it. 
> 
> Is there a shell command that will cause init to fork the new process
> instead of the shell?

  $ cat daemon.sh
  #!/bin/sh

  sleep 600 &

  kill $$

  $ sh daemon.sh
  Terminated
  $ ps axj | egrep '(^USER|sleep)'
  USER     PID  PPID  PGID   SESS JOBC STAT  TT       TIME COMMAND
  cjc    51858     1 51857 c04580    0 S     p3    0:00.00 sleep 600

-- 
Crist J. Clark                           cjclark@alum.mit.edu


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010115234820.M97980>