I have a machine hosting an LDAP database and services on other machines run as users from that database. Because the user accounts does not exist locally, the services fail to start when those machines boot before the machine hosting the LDAP database.
All the machines are running Ubuntu 14.04 except for one that is running CentOS 7. Is it possible with upstart and systemd to wait for the LDAP database to be available before starting certain services?
EDIT: I've tried using a pre-start script with Upstart that loops until LDAP is available, but that doesn't work. I found in the Upstart cookbook that the pre-start script is run as user and group specified with "setuid" and "setgid". So the pre-start script is never run because the user and group doesn't exist until the LDAP service is running on another machine.
I tried specifying "respawn" as well but that didn't help in this case. From what I understand from the Upstart cookbook, respawn only takes effect when the main script or executable fails. Thus, the service is not restarted because the service fails before any script is run.