Skip to content

ts-academy/bash-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 

Repository files navigation

πŸš€ DevOps Bash Toolkit Assessment

GitHub Workflow Status GitHub repo size GitHub last commit License


πŸ“Œ Overview

This assignment tests your DevOps fundamentals:

  • Bash scripting
  • Git workflow (branching, commits, pull requests)
  • Automation mindset
  • System monitoring and logging

You will build a real-world automation toolkit and submit it via a Pull Request (PR).


πŸ“ Project Structure

devops-bash-toolkit-assestment/
β”‚
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ user_info.sh
β”‚   β”œβ”€β”€ system_check.sh
β”‚   β”œβ”€β”€ file_manager.sh
β”‚   β”œβ”€β”€ backup.sh
β”‚   β”œβ”€β”€ process_monitor.sh
β”‚
β”œβ”€β”€ run_all.sh              # OPTIONAL (Bonus)
β”‚
β”œβ”€β”€ README.md

πŸ§‘β€πŸ’» Getting Started

  1. Fork the Repository

Click the Fork button on GitHub.

  1. Clone Your Fork
git clone <your-fork-url>
cd devops-bash-toolkit
  1. Create a Feature Branch
git checkout -b feature/<your-name>
  1. Complete the Scripts Implement all required scripts inside:
scripts/
  1. Make Scripts Executable
chmod +x scripts/*.sh
  1. Commit Your Work
git add .
git commit -m "feat: complete bash scripts"
  1. Push to GitHub
git push origin feature/<your-name>
  1. Create Pull Request

Open a Pull Request to the main repository.

🧠 Assignment Tasks

πŸ”Ή A. user_info.sh Requirements

  • Prompt the user for:

    • Name

    • Age

    • Country

  • Validate:

    • Age must be numeric
  • Output:

    • A greeting message
  • Age category:

    • Minor (<18)

    • Adult (18–65)

    • Senior (65+)

  • Handle missing or invalid input gracefully

  • Save output to:

logs/user_info.log

πŸ”Ή B. system_check.sh Requirements

  • Display:

    • Disk usage (df -h)

    • Memory usage (free -m)

    • CPU load (uptime)

  • Warn if disk usage exceeds 80%

  • Save report to:

logs/system_report_<date>.log
  • Count total running processes

  • Display top 5 memory-consuming processes


πŸ”Ή C. file_manager.sh Requirements

  • Support the following commands:

    • create

    • delete

    • list

    • rename

  • Example usage:

./file_manager.sh create file.txt
  • Prevent overwriting existing files

  • Log all actions to:

logs/file_manager.log

πŸ”Ή D. backup.sh Requirements

  • Accept a directory as input

  • Validate that the directory exists

  • Create a compressed backup:

backup_<timestamp>.tar.gz
  • Store backups in:
backups/
  • Keep only the last 5 backups (delete older ones)

  • Log backup activity


⭐ E. process_monitor.sh(Optional Bonus) Requirements

  • Accept a process name as input

  • Check if the process is running

  • If NOT running:

    • Attempt restart (or simulate restart)
  • Output:

    • Running

    • Stopped

    • Restarted

  • Use an array:

services=("nginx" "ssh" "docker")
  • Log monitoring results

⭐ F. run_all.sh (Optional Bonus) Requirements

Provide an interactive menu:

  1. Run all
  2. System check
  3. Backup
  4. Exit
  • Use functions to organize logic

  • Call scripts from the scripts/ directory

  • Include:

    set -euo pipefail
  • Log all actions to:

logs/app.log
  • Handle script failures gracefully

Submission link: CLICK HERE

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors