executing a service after another service has been started
i have actually mounted MySQL NDB collection. It requires around 2 - 3 mins to synchronise the data source in between collection nodes. As soon as the synchronisation ended up just, I can start an additional application called heart beat. Consequently in my shell manuscript, I intend to examine the schedule of the ndbd solution regularly. As soon as this solution appear, I require to start the heart beat application in 5 minute time. Can you please aid me to write the manuscript.
You can additionally attempt making use of the "wait" bash constructed - in command.
From "man bash"
Wait for the defined procedure and also return its discontinuation standing. n might be a procedure ID or a work requirements ; if a work specification is offered, all procedures because work' s pipe are awaited. If n is not offered, all presently energetic youngster procedures are awaited, and also the return standing is absolutely no. If n defines a non - current procedure or work, the return standing is 127. Or else, the return standing is the exit standing of the last procedure or work awaited.
You manuscript can look something similar to this:
# send to background ./ndb_startup_script & # wait on pid of ndb_startup_script wait $! if [ $? -eq 0 ] # assuming 0 is ret code for successful run then ./heartbeat_startup_script else # extra stuff to handle error fi
What I needed to is have the ndb manuscript director an additional manuscript, to make sure that it is not awaiting the 5 mins to end up and also obstructing various other solutions from beginning.
## whatever starts ndb exec heartbeat_startup_script
I've placed a rest 300 (secs) in below, create you've defined 5 mins, yet examining if the ndb sync is done would certainly be better.
##heartbeat_startup_script sleep 300 heartbeat