lib/ventriloquist/cap/debian/ventriloquist_containers_upstart.rb in ventriloquist-0.3.0 vs lib/ventriloquist/cap/debian/ventriloquist_containers_upstart.rb in ventriloquist-0.3.1
- old
+ new
@@ -9,20 +9,26 @@
machine.env.ui.info('Configuring Ventriloquist services upstart')
machine.communicate.sudo '
cat<<EOF > /etc/init/ventriloquist.conf
description "Restart configured Ventriloquist services after reboot"
-start on (started docker)
+start on started docker
+task
+
script
if [ -d /var/lib/ventriloquist/cids ]; then
sleep 1 # Give Docker some time
for cidfile in \$(ls /var/lib/ventriloquist/cids/*); do
- docker start \$(cat \$cidfile)
+ cid=\$(cat \$cidfile)
+ if ! $(docker ps | grep -q $cid); then
+ docker start \$(cat \$cidfile)
+ else
+ echo "Container ${cid} already started"
+ fi
done
fi
end script
-respawn
EOF'
end
end
end
end