Starting multiple upstart instances automatically

╄→гoц情女王★ 提交于 2019-11-29 19:53:46

What you need is a bootstrap task that runs on startup and iterates over all your worker jobs, starting each one.

#/etc/init/async-workers-all.conf

start on runlevel [2345]

task

env NUM_WORKERS=8

script
  for i in `seq 1 $NUM_WORKERS`
  do
    start async-worker N=$i
  done
end script

The key is to make this a task, which tells upstart to let the task run to completion before emitting any events for it. See http://upstart.ubuntu.com/cookbook/#task and http://upstart.ubuntu.com/cookbook/#instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!