Skip to content

celetrialprince166/Linux_Mini_Challenge_SysAdmin_Starter_Pack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevOps Challenge: SysAdmin Starter Pack

Overview

Simple Bash script setup-environment.sh automates creating a starter folder layout with logs, configs, and scripts, adds sample content, and sets permissions. Includes idempotent directory creation and a fallback when tree is unavailable (e.g., Git Bash on Windows).

What the script does

  • Creates directories: logs/, configs/, scripts/ (skips if they already exist).
  • Creates files with starter content: logs/system.log, configs/app.conf, scripts/backup.sh.
  • Ensures configs/app.conf is writable before rewriting on reruns, then sets permissions:
    • logs/system.log -> 644
    • configs/app.conf -> 444
    • scripts/backup.sh -> 755
  • Shows structure with tree . or falls back to find . -maxdepth 4 -print.
  • Lists permissions with ls -lR ..

How to run

chmod +x setup-environment.sh
./setup-environment.sh

Expected outputs

  • Full-screen run showing date/time: screenshots/full-run.png (replace with your capture). Full-screen run showing date/time
  • A rerun showiwing the idempotency of the script and robust error handling : screenshots/rerun.png A rerun showiwing the idempotency of the script and robust error handling

Problems faced and fixes

  • tree not found in Git Bash on Windows → added a check: use tree . when available, otherwise fall back to find . -maxdepth 4 -print.
  • Re-running after setting configs/app.conf to read-only (444) caused “Permission denied” → added chmod u+w configs/app.conf 2>/dev/null || true before rewriting so reruns succeed without breaking on set -e.

About

Linux_Mini_Challenge_SysAdmin_Starter_Pack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages