You may directly call the API to start and stop all the services which will take care of starting them in the required order instead of doing them one by one if that achieves what you are looking for.
For example: To stop, Hit the URL of the form: url = "http://" + <ambari-server-address> + ":8080/api/v1/clusters/" + <ambari-cluster-name> + "/services?" Have the payload as below. data = { "RequestInfo":{ "context":"Stop all services","operation_level":{"level":"CLUSTER","cluster_name": <ambari-cluster-name>} },"Body":{"ServiceInfo":{"state":"INSTALLED"}} } For start just change the state to "STARTED" Thanks, Bhuvnesh Chaudhary Email: bchau <[email protected]>[email protected] Desk: +1-650-846-1696 | Mobile: +1-973-906-6976 On Mon, Nov 16, 2015 at 1:06 PM, James Tanner <[email protected]> wrote: > Has anyone written and can share a bash/python script that will start and > stop -all- ambari managed services in the right order? > > I'm trying to build images that will start services on boot and kill them > on shutdown, so I need something suitable for sysvinit+systemd. >
