Files
it-knowledge/src/solutions/shell-scripting.md
T

2.0 KiB

Shell Scripting Solutions [📜]

This section documents my solutions to shell scripting scenarios, including automation, monitoring, and system management scripts.

Scenario Tags

Tag Description
[v1-S6] Shell Scripting - Practice Scenarios v1
[v2-S6] Automation Script - Practice Scenarios v2
[v3-S6] System Automation - Practice Scenarios v3

Scenario: [v1-S6] Shell Scripting

Original Problem

From Practice Scenarios v1, Scenario 6: Create a script that:

  1. Accepts a directory path as an argument
  2. Finds all files larger than 100MB
  3. Creates a report of these files including size and last modified date
  4. Archives files older than 30 days into a tar.gz file
  5. Logs all actions to /var/log/cleanup.log

Environment

  • OS Version: [To be filled]
  • Initial State: [To be filled]
  • Required Outcome: [To be filled]

Solution Steps

[Your solution will be added here]

Scenario: [v2-S6] Automation Script

Original Problem

From Practice Scenarios v2, Scenario 6: Create a script that:

  1. Monitors disk space usage
  2. Sends alerts when filesystems exceed 80% usage
  3. Automatically cleans up /tmp older than 7 days
  4. Generates daily system health report
  5. Uses getopts for command line options

Environment

  • OS Version: [To be filled]
  • Initial State: [To be filled]
  • Required Outcome: [To be filled]

Solution Steps

[Your solution will be added here]

Scenario: [v3-S6] System Automation

Original Problem

From Practice Scenarios v3, Scenario 6: Create scripts for:

  1. System inventory script that:
    • Lists all installed packages
    • Shows disk usage
    • Reports running services
    • Checks SELinux status
  2. Backup script that:
    • Uses tar with incremental backups
    • Implements retention policy
    • Verifies backup integrity
    • Logs all operations

Environment

  • OS Version: [To be filled]
  • Initial State: [To be filled]
  • Required Outcome: [To be filled]

Solution Steps

[Your solution will be added here]