I am running multiple instances of a worker as described in this answer: Starting multiple upstart instances automatically
Question: Can I restart all instances at once?
To start my workers I can do:
initctl start my-workers
Which then allows me to do:
initctl status worker N=1 worker (1) start/running, process 551
initctl status worker N=2 worker (2) start/running, process 552
Is there a way to do something like this:
initctl restart my-workers
I would like to be able to restart all instances without having to know how many are running.
Here is my my-workers.conf
start on stopped cloud-init
stop on shutdown
env NUM_WORKERS=4
script
for i in `seq 1 $NUM_WORKERS`
do
start worker N=$i
done
end script
And worker.conf
stop on shutdown
chdir /path/to/current
respawn
instance $N
script
exec su -c "/home/worker/.rvm/bin/rvm-shell -c 'bundle exec rake work 2>&1 >> /var/log/worker-$N.log'" worker
end script