Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Mar 2016 14:54:10 -0700
From:      Jim Long <james@umpquanet.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Seeking a solid startup script for node.js/forever
Message-ID:  <20160318215410.GA45558@ns.umpquanet.com>
In-Reply-To: <20160318213735.GA43466@ns.umpquanet.com>
References:  <20160318193603.GA20566@ns.umpquanet.com> <20160318213735.GA43466@ns.umpquanet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Sigh.  I should test before I post.

The fix below is not sufficient.  It "mostly works" from inside the jail:

jailname : 14:44:06 /# service iws stop
jailname : 14:44:17 /# service iws start
jailname : 14:44:19 /# warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: /usr/local/IWS4/app.js

But it doesn't work from outside the jail.  "service jail start" doesn't return to a shell prompt
unless I hit Ctrl-C.

hostname : 14:44:41 /root# service jail stop
Stopping jails: jailname
hostname : 14:44:45 /root# time service jail start
Starting jails:
load: 0.13  cmd: node 25865 [uwait] 94.17r 0.23u 0.03s 0% 33028k
^C

real    1m41.749s
user    0m0.010s
sys     0m0.017s

hostname : 14:44:23 /root#


On Fri, Mar 18, 2016 at 02:37:35PM -0700, Jim Long wrote:
> 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



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