node.js - OSX launchd plist for node forever process -


i trying write launchd.plist file node server. using forever run node server. server start on boot. wait mongodb launchd plist run first.

i installed mongobb using homebrew , came launchd.plist already. have executed following:

$ launchctl load ~/library/launchagents/homebrew.mxcl.mongodb.plist 

plist mongodb is:

<!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0"> <dict>   <key>label</key>   <string>homebrew.mxcl.mongodb</string>   <key>programarguments</key>   <array>     <string>/usr/local/opt/mongodb/mongod</string>     <string>run</string>     <string>--config</string>     <string>/usr/local/etc/mongod.conf</string>   </array>   <key>runatload</key>   <true/>   <key>keepalive</key>   <false/>   <key>workingdirectory</key>   <string>/usr/local</string>   <key>standarderrorpath</key>   <string>/usr/local/var/log/mongodb/output.log</string>   <key>standardoutpath</key>   <string>/usr/local/var/log/mongodb/output.log</string>   <key>hardresourcelimits</key>   <dict>     <key>numberoffiles</key>     <integer>1024</integer>   </dict>   <key>softresourcelimits</key>   <dict>     <key>numberoffiles</key>     <integer>1024</integer>   </dict> </dict> </plist> 

if shutdown computer , restart mongodb fires should.

however node server not starting. ideas?

<?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0//en" "http://www.apple.com/dtds/propertylist-1.0.dtd"> <plist version="1.0">     <dict>         <key>keepalive</key>         <dict>             <key>successfulexit</key>             <false/>         </dict>         <key>label</key>         <string>com.test.app</string>         <key>programarguments</key>         <array>             <string>/usr/local/bin/forever</string>             <string>-a</string>             <string>-l</string>             <string>/var/log/app/app.log</string>             <string>-e</string>             <string>/var/log/app/app_error.log</string>             <string>/data/server/app.js</string>         </array>         <key>runatload</key>         <true/>         <key>startinterval</key>         <integer>3600</integer>     </dict> </plist> 

edit:

writing log file , see this:

env: node: no such file or directory

i think means node binary cannot found. can echo $path , /usr/local/bin in path. can start node terminal. ideas?

add environment variables worked me.

<key>environmentvariables</key> <dict>   <key>path</key>   <string>/usr/local/bin/:$path</string> </dict> 

you may need add workingdirectory node app.

<key>workingdirectory</key> <string>path/to/your/node/app</string> 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -