OCI script to create File System snapshots with a retention period


OCI File Storage provides network file system storage. One of its capabilities is the option to create snapshots.

In this post we are building a shell script that creates snapshots regularly and deletes those older than a specific number of days

Steps

Get the ocid of the file system you want to create snapshots for

Create an script like this

#
rm oci_fs_snapshot_with_retention.sh
#
wget https://raw.githubusercontent.com/javiermugueta/rawcontent/master/oci_fs_snapshot_with_retention.sh
#
chmod 700 oci_fs_snapshot_with_retention.sh
#
fs=<filesystemocid>
#
./oci_fs_snapshot_with_retention.sh $fs <retentionperiodindays>
#

Let’s see how it works by executing the script from DevCS

Job in DevCS
Result of job execution

That’s all folks, hope it helps and stay home! 🙂

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: