Skip to content

Protein-DevOps-Engineer-Bootcamp/1-hafta-odev-1-shell-scripting-huyagci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Protein DevOps Engineer Bootcamp

Project of the First Week

Built with;

Linux Bash Git VirtualBox Vagrant

1️⃣ Assignment

Backup home directories of all existing users in the system as a gzip archive and create an MD5 checksum of the archives every day at 11:05 PM with a log file of the last run time of the script.

2️⃣ Assignment

Create a script that checks the disk usage of partitions mounted on the root and build a warning system that sends a warning email to the specified user if the threshold is exceeded.

Table of Contents

  1. Overview
  2. Features
  3. Usage
  4. Technologies
  5. Directories

📔 Overview

This repository undertakes two projects developed under the Patika.dev & Protein DevOps Engineer Bootcamp as an assignment. It contains three scripts whose usage is mentioned below. bootstrap.sh is an initializer script that sets up the machine as instructed. backup_home_dirs.sh and disk_usage_alert.sh are the assignment scripts that are coded by the terms of the project.

Features

Bootstrap Script

  • Sets the timezone of the machine as UTC+3 (Europe/Istanbul) and enables Network Time Protocol.
  • Downloads latest package information.
  • Installs sSMTP and mailutils.
  • Sets the sSMTP configuration as specified.
  • Writes cron jobs onto the system-wide crontab file.

Home Directory Backup

  • Takes the backup of all normal users in the system. (UID Range: 1000 - 60000)
  • Formats the name of the archives as "username--DD-MM-YYYY--MM-HH.tar.gz"
  • Creates the MD5 checksums of the archives in the same directory.
  • Will work every day @ 11:05 PM if you execute bootstrap.sh
  • Logs its last run time under /tmp/logs/

Disk Usage Alerts

  • Checks the disk space of / every minute if you execute bootstrap.sh
  • If the used space exceeds your defined threshold, the script will send you an email. (Default threshold is set to: 90%)
  • The email will contain the partition name, machine name, and left space information, as well as the timestamp of the execution.

⚙️ Usage

Automated

  1. Install VirtualBox and Vagrant to your machine if you do not have them.
  2. Clone the project to your machine.
  3. Open your CLI, change directory to project directory, and type vagrant up.
  4. All the scripts will start running automatically and perform their commands.

Manual

  1. Download the project files.
  2. Copy all files under the /shared/scripts/ to your environment.
  3. Execute bootstrap.sh first to configure the machine settings.
  4. Run the scripts manually from the directories that are stated below.

💻 Technologies

  • Linux ❤️
  • Bash Scripting
  • Git SCM
  • Oracle VM VirtualBox
  • Vagrant by HashiCorp

📂 Directories

Scripts & Configurations : /opt/scripts
Backup Archives          : /mnt/backups
MD5 Checksums            : /mnt/backups
Last Run Log             : /tmp/scripts

About

1-hafta-odev-1-shell-scripting-huyagci created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages