Question
I need a basic script that will check my s3 bucket and print the number of logs in the bucket or return the error messages
I need a basic script that will check my s3 bucket and print the number of logs in the bucket or return the error messages below
Linux/RHEL 7
write the zkills3ctl.sh script to print the logs stored in S3, The normal output format and error output format must look exactly like the examples in the man page.
NAME zkills3ctl -- control zkill log archives. SYNOPSIS zkills3ctl [number]
DESCRIPTION The zkill archive tool lists the logs in the S3 bucket specified by . Optionally, it will delete the oldest logs from S3.
OPTIONS [number] The number of oldest logs to delete.
ERRORS Return codes: -1 The bucket name does not exist. -2 There are fewer logs in the bucket than [number]. -3 Cannot connect to S3
EXAMPLE
$ zkills3ctl UML
zkill-2018-03-04-1520200486.gz
zkill-2018-03-04-1520201201.gz
$ zkills3ctl UML 1
Deleted zkill-2018-03-04-1520200486.gz
$ zkills3ctl UML
zkill-2018-03-04-1520201201.gz
$ zkills3ctl FOO
Error -1 no such bucket exists
$ zkills3ctl UML 2
Error -2 there is only 1 log in the bucket UML
$ mv ~/.aws/credentials /tmp
$ zkills3ctl UML
Error -3 cannot connect to S3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started