From owner-freebsd-questions@freebsd.org Fri Mar 18 21:37:36 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D69EDAD4B9F for ; Fri, 18 Mar 2016 21:37:36 +0000 (UTC) (envelope-from list@museum.rain.com) Received: from ns.umpquanet.com (ns.umpquanet.com [98.158.10.80]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD3E8B3D for ; Fri, 18 Mar 2016 21:37:36 +0000 (UTC) (envelope-from list@museum.rain.com) Received: from ns.umpquanet.com (localhost [127.0.0.1]) by ns.umpquanet.com (8.14.9/8.14.9) with ESMTP id u2ILbZLg044120 for ; Fri, 18 Mar 2016 14:37:35 -0700 (PDT) (envelope-from list@museum.rain.com) Received: (from james@localhost) by ns.umpquanet.com (8.14.9/8.14.9/Submit) id u2ILbZYC044119 for freebsd-questions@freebsd.org; Fri, 18 Mar 2016 14:37:35 -0700 (PDT) (envelope-from list@museum.rain.com) Date: Fri, 18 Mar 2016 14:37:35 -0700 From: Jim Long To: freebsd-questions@freebsd.org Subject: Re: Seeking a solid startup script for node.js/forever Message-ID: <20160318213735.GA43466@ns.umpquanet.com> References: <20160318193603.GA20566@ns.umpquanet.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160318193603.GA20566@ns.umpquanet.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2016 21:37:36 -0000 On Fri, Mar 18, 2016 at 12:36:03PM -0700, Jim Long wrote: > How can I modify this script so that it will start cleanly in the > background? I guess the obvious, brute force solution is: --- iws.orig 2016-03-18 14:35:21.206449824 -0700 +++ iws 2016-03-18 14:33:39.770357734 -0700 @@ -31,7 +31,7 @@ start() { NODE_ENV=production - su -m www -c "exec ${forever} start -a -l ${HOME}/forever.log -o ${HOME}/output.log -e ${HOME}/error.log -p /var/run/forever ${script}" + su -m www -c "exec ${forever} start -a -l ${HOME}/forever.log -o ${HOME}/output.log -e ${HOME}/error.log -p /var/run/forever ${script}" & } status() but if anyone has something more elegant, I'd be grateful to learn of it. Jim