Built with;
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.
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.
📔 Overview 🔝
This repository undertakes two projects developed under the Patika.dev & Protein DevOps Engineer Bootcamp as an assignment. SysWard
is a collection of 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 🔝
- 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.
- 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/
- Checks the disk space of
/
every minute if you executebootstrap.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 🔝
- Install VirtualBox and Vagrant to your machine if you do not have them.
- Clone the project to your machine.
- Open your CLI, change directory to project directory, and type
vagrant up
. - All the scripts will start running automatically and perform their commands.
- Download the project files.
- Copy all files under the
/shared/scripts/
to your environment. - Execute
bootstrap.sh
first to configure the machine settings. - Run the scripts manually from the directories that are stated below.
💻 Technologies 🔝
- Linux ❤️
- Bash Scripting
- Oracle VM VirtualBox
- Vagrant by HashiCorp
📂 Directories 🔝
Scripts & Configurations : /opt/scripts
Backup Archives : /mnt/backups
MD5 Checksums : /mnt/backups
Last Run Log : /tmp/scripts
💾 Submitted Assignment 🔝
You may check out the submitted version of this project here.