Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

start and stop all the services in ambari in time intervals?

avatar
Contributor

Hi everyone,

i want to start all the services in ambari in time inrevals in autmated way.

like i need all the services to start daily at 7am and i want to stop at 5pm.

so that i will start the ec2-instances at 6:30am and i will stop those by 5:30pm.

can you please help me out.

thanks in advance

1 ACCEPTED SOLUTION

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
3 REPLIES 3

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Contributor

can you please tell me how to setup cron job for the rest api

avatar
Master Mentor

@pavan p

1. Open a terminal and run the following command to open the crontab editor (it's like "vi" editor)

# crontab -e


2. Now add the following entries inside it: (here 30 17 means 5:30 PM) and similarly (30 06 means 6:30 AM)

30 17 * * * curl -u admin:admin  -H 'X-Requested-By:ambari' -X PUT     -d '{"RequestInfo":{"context":"_PARSE_.STOP.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"BlueprintCluster"}},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' http://blueprint.example.com:8080/api/v1/clusters/BlueprintCluster/services?

30 06 * * * curl -u admin:admin  -H 'X-Requested-By:ambari' -X PUT     -d '{"RequestInfo":{"context":"_PARSE_.START.ALL_SERVICES","operation_level":{"level":"CLUSTER","cluster_name":"BlueprintCluster"}},"Body":{"ServiceInfo":{"state":"STARTED"}}}' http://blueprint.example.com:8080/api/v1/clusters/BlueprintCluster/services?

.

Reference:

https://www.drupal.org/docs/7/setting-up-cron-for-drupal/configuring-cron-jobs-using-the-cron-comman...