in reply to Re: background w/out fork?
in thread background w/out fork?

the goal is to detach from the tty ... if the job needs to be invoked via command line, it's still attached.

Replies are listed 'Best First'.
Re^3: background w/out fork?
by Old_Gray_Bear (Bishop) on Jun 30, 2004 at 23:17 UTC
    Then what you want is
    nohup /usr/local/sbin/relaydelay.pl $CONFIG > /var/log/relaydelay.l +og 2>&1 &
    Update: Fix Typoes. It's been a long month....

    ----
    I Go Back to Sleep, Now.

    OGB

      don't forget stdin! i don't know if it's really needed but i think it keeps my ssh from hanging when i exit (maybe because some process still has the pty open as stdin?)

      nohup /usr/local/sbin/relaydelay.pl $CONFIG >/var/log/relaydelay.lg 2> +&1 </dev/null &
Re^3: background w/out fork?
by iburrell (Chaplain) on Jul 01, 2004 at 16:11 UTC
    If you want to detach from the tty, and from session group, then use Proc::Daemon. It handles all the details of the double fork, creating new session group, and closing all filehandles. You will need to reopen stderr or stdout after the process becomes a daemon.