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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!