We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I got the following example from @t-richard to run cronjobs only on single instance:
# Source: https://github.com/awsdocs/elastic-beanstalk-samples/blob/master/configuration-files/aws-provided/instance-configuration/cron-leaderonly-linux.config packages: yum: jq: [] files: "/usr/local/bin/test_cron.sh": mode: "000755" owner: root group: root content: | #!/bin/bash INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null` REGION=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document 2>/dev/null | jq -r .region` # Find the Auto Scaling Group name from the Elastic Beanstalk environment ASG=`aws ec2 describe-tags --filters "Name=resource-id,Values=$INSTANCE_ID" \ --region $REGION --output json | jq -r '.[][] | select(.Key=="aws:autoscaling:groupName") | .Value'` # Find the first instance in the Auto Scaling Group FIRST=`aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names $ASG \ --region $REGION --output json | \ jq -r '.AutoScalingGroups[].Instances[] | select(.LifecycleState=="InService") | .InstanceId' | sort | head -1` # If the instance ids are the same exit 0 [ "$FIRST" = "$INSTANCE_ID" ] "/etc/cron.d/cronjobs": mode: "000644" owner: root group: root content: | * * * * * root /usr/local/bin/test_cron.sh && whatever command you need commands: remove_old_cron: command: "rm -fr /etc/cron.d/cron_example.bak" ignoreErrors: true
Maybe similar adjustments would be needed to run the supervisor only on one instance.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I got the following example from @t-richard to run cronjobs only on single instance:
Maybe similar adjustments would be needed to run the supervisor only on one instance.
The text was updated successfully, but these errors were encountered: