Uh, oh... yes, that's it :*)
Thanks!!

On Mon, Mar 19, 2012 at 10:58 PM, Steven Campbell <[email protected]>wrote:

> Possibly the ampersand at the end of the exec line?
>
>
> On Monday, March 19, 2012 7:26:51 AM UTC-5, HG wrote:
>>
>> Hi!
>>
>> Can you tell me what I'm doing wrong. I'm trying to deploy to Redhat 6.1
>> using upstart. If I do it as root, it works, but I cannot get it done as a
>> user. It always tries to start multiple instances of the node process when
>> I run this /etc/init/NodeApp.conf script:
>>
>> #!upstart
>> description "node.js HTTP-server"
>> author      "me"
>>
>> # One example said that it's safer to start after mounts
>> #start on startup
>> start on started mountall
>> stop on shutdown
>>
>> # respawn
>> respawn
>> # If the process is respawed more than 3 times within an interval of 10
>> seconds the process will be stopped and not restarted
>> respawn limit 3 10
>>
>> script
>>     export NODE_ENV="production"
>>
>>    # Somebody wrote: Not sure why $HOME is needed, but we found that it
>> is:
>>     export HOME="/home/nodeuser/"
>>
>>    echo $$ > /var/run/NodeApp.pid
>>     # sudo doesn't work on redhat
>>    # exec sudo -u nodeuser /usr/local/bin/node
>> /home/nodeuser/dev/NodeApp-4.**js >> /var/log/NodeApp.log 2>&1
>>     exec su --session-command="/usr/local/**bin/node
>> /home/nodeuser/dev/NodeApp/**NodeApp-4.js" >> /var/log/NodeApp.log 2>&1
>> nodeuser &
>>
>>    ### Why does this run spawnlimit+1 times at the startup ?!?
>>
>>    # root works:
>>    #echo $$ > /var/run/NodeApp.pid
>>     #export HOME="/root"
>>    #exec /usr/local/bin/node /home/nodeuser/dev/NodeApp/**NodeApp-4.js
>> >> /var/log/NodeApp.log 2>&1
>> end script
>>
>> pre-start script
>>     # Date format same as (new Date()).toISOString() for consistency
>>    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >>
>> /var/log/NodeApp.log
>> end script
>>
>> pre-stop script
>>     rm /var/run/NodeApp.pid
>>    echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >>
>> /var/log/NodeApp.log
>> end script
>>
>>
>> The problem is that when I issue: sudo start NodeApp this starts the
>> process 4 times (spawnlimit+1). First one of those, will get the http port
>> and the rest will fail as the port is already taken. And as the result of
>> that, the NodeApp,pid file has the las PID which failed and the first one
>> that is running is not recorded. If I run this as root (commented out),
>> this works as expected. What am I doing wrong?
>>
>> --
>> HG.
>>
>>  --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>



-- 
HG.

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to