Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

My Node.js server upstart job config:

start on (net-device-up and runlevel [2345] and started td-agent)
stop on runlevel [016]

respawn

env HOME="/var/nodes"

script
    chdir $HOME
    exec /usr/local/bin/node index.js -c app/config/live >> /var/log/node/server.log 2>> /var/log/node/server_error.log
end script

When I run:

initctl check-config node

I got this:

node
  start on: unknown job td-agent

When Server is booted, Node is down, but I can manually start it:

service node start
node start/running, process 1156

EDIT: If I remove and started td-agent, it is started on boot. But I need Node started after td-agent. How can I fix this issue?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Upstart seems to know nothing about td-agent. That is because upstart only recognizes jobs started by upstart.

Probably td-agent is started by a script in /etc/init.d. If that is the case, you can not use upstart to start node and have it depend on td-agent.

The solution is not to use upstart. You need to write a new script to /etc/init.d that starts node.

You must make it run after td-agent start script. When you have your script, use update-rc.d command to define when it starts.

Here is a link to an example minimal start script. It is for liferay but just fix the environment variables, and replace start() and stop() functions with your own definitions. Example liferay initd script.

share|improve this answer
    
Yes, td-agent is started by /etc/init.d script. I thought upstart daemon monitors processes for td-agent, but you say it has to be upstart job - sounds reasonable. Yea, I know how to create start / stop scripts. Thank you! –  Roman Newaza Mar 18 '13 at 1:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.