1

This script will start the services:

#!upstart

description "example.com"
author      "Geert"

script
  for service in "website" "feeds" "jobs"
  do
    exec start service.example.com service=$service
  done
end script

The service script looks like this:

#!upstart

description "service.example.com"
author      "Geert"

start on (local-filesystems and net-device-up IFACE=eth0) 
stop  on shutdown

respawn                # restart when job dies

instance $service

script
  exec /home/fs/.nvm/v0.6.7/bin/coffee /home/fs/Dropbox/work/2012/krafters/$service.coffee
end script

The problem I have is that it only seems to be creating the website service.

initctl list | grep example
example.com stop/waiting
service.example.com (website) start/running, process 22787
1

Firstly, Upstart job configuration files (.conf files) are not scripts in the conventional sense: the first line you have ('#!upstart') is completely redundant and will be treated only as a comment.

Your problem is the use of 'exec' in the first .conf file with the for loop: exec replaces the currently running shell with whatever argument you give exec so only the first entry in the for loop will be run.

To fix this, simply remove 'exec' in the first .conf file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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