You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ambari.apache.org by James Tanner <ta...@gmail.com> on 2015/11/16 22:06:47 UTC

simple ambari service startup script?

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.

Re: simple ambari service startup script?

Posted by James Tanner <ta...@gmail.com>.
Nice, I will try that. Thank you.

On Mon, Nov 16, 2015 at 4:21 PM, Bhuvnesh Chaudhary <bc...@pivotal.io>
wrote:

> 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 <bc...@gopivotal.com>dhary@pivotal.io
> Desk: +1-650-846-1696 | Mobile: +1-973-906-6976
>
> On Mon, Nov 16, 2015 at 1:06 PM, James Tanner <ta...@gmail.com> 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.
>>
>
>

Re: simple ambari service startup script?

Posted by Bhuvnesh Chaudhary <bc...@pivotal.io>.
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 <bc...@gopivotal.com>dhary@pivotal.io
Desk: +1-650-846-1696 | Mobile: +1-973-906-6976

On Mon, Nov 16, 2015 at 1:06 PM, James Tanner <ta...@gmail.com> 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.
>