Skip to content

avula-ramesh16/shell-scripting-project

Repository files navigation

🧑‍💻 DevOps Shell Scripting Project Pack

A complete collection of real-time shell scripts used by DevOps Engineers in day-to-day automation tasks.
These scripts cover Linux administration, monitoring, AWS, Jenkins CI/CD, and Kubernetes automation — from basic to advanced use cases.


🚀 Overview

This repository demonstrates hands-on automation using Bash Shell Scripting — essential for managing DevOps pipelines and cloud infrastructure efficiently.
All scripts are written in Bash, follow best practices (set -euo pipefail), and are ready for integration with Jenkins, AWS CLI, and Kubernetes (kubectl).


🧩 Project List

🧱 1. Log Monitor & Alert Script

File: log_monitor.sh
Continuously monitors application logs and sends email alerts when errors are detected.

  • Key Tools: tail, grep, mail
  • Usage:
    bash log_monitor.sh

💾 2. Disk Space Monitor Script

File: disk_alert.sh
Checks system disk usage and alerts when usage exceeds the defined threshold.

  • Key Tools: df, awk, mail
  • Usage:
    bash disk_alert.sh

⚙️ 3. Process Health Check Script

File: process_monitor.sh
Verifies that critical services (e.g., nginx, mysql, jenkins) are running; restarts them if not.

  • Key Tools: systemctl, arrays, logging
  • Usage:
    bash process_monitor.sh

🗄️ 4. Log Backup & Rotation Script

File: log_rotate.sh
Archives logs older than 7 days and removes old files to save disk space.

  • Key Tools: find, tar, cron
  • Usage:
    bash log_rotate.sh

☁️ 5. AWS EC2 Instance Status Check

File: aws_ec2_status.sh
Fetches and displays EC2 instance IDs, names, and states using AWS CLI.

  • Key Tools: aws cli, JSON query filters
  • Usage:
    bash aws_ec2_status.sh

🚀 6. Jenkins Deployment Helper

File: deploy_app.sh
Automates CI/CD deployment from Git → Docker → ECR → ECS with AWS CLI integration.

  • Key Tools: git, docker, aws ecr, aws ecs
  • Usage:
    bash deploy_app.sh

Kubernetes Automation Scripts

🔹 7. Kubernetes Pod Health Check

File: k8s_pod_health_check.sh
Checks for non-running pods in a namespace and sends alerts.

  • Key Tools: kubectl, awk, mail
  • Usage:
    bash k8s_pod_health_check.sh

🔹 8. Kubernetes Deployment Rollout Script

File: k8s_rollout_update.sh
Automates updating container images and verifying rollout success.

  • Key Tools: kubectl set image, rollout status
  • Usage:
    bash k8s_rollout_update.sh

🔹 9. Kubernetes Pod Restart Script

File: k8s_restart_pod.sh
Restarts a deployment safely and checks rollout completion.

  • Key Tools: kubectl rollout restart
  • Usage:
    bash k8s_restart_pod.sh

🧰 Jenkins Integration Scripts

🔸 10. Jenkins Job Trigger Script

File: jenkins_trigger.sh
Remotely triggers Jenkins jobs using the REST API and user tokens.

  • Key Tools: curl, Jenkins API
  • Usage:
    bash jenkins_trigger.sh

🔸 11. Jenkins Build Status Checker

File: jenkins_build_status.sh
Fetches the status (SUCCESS/FAILURE) of the latest Jenkins build.

  • Key Tools: curl, jq, Jenkins API
  • Usage:
    bash jenkins_build_status.sh

🧠 Best Practices Used

  • set -euo pipefail for error-safe scripting
  • ✅ Logging for all automation scripts
  • ✅ Email alerts for monitoring
  • ✅ Parameterized values (e.g., namespace, region, repo)
  • ✅ Integration-ready for Jenkins, AWS, Kubernetes

🗂️ Folder Structure

devops-shell-scripts/
│
├── log_monitor.sh
├── disk_alert.sh
├── process_monitor.sh
├── log_rotate.sh
├── aws_ec2_status.sh
├── deploy_app.sh
│
├── k8s_pod_health_check.sh
├── k8s_rollout_update.sh
├── k8s_restart_pod.sh
│
├── jenkins_trigger.sh
└── jenkins_build_status.sh

🧩 Requirements

  • Linux environment (Ubuntu/CentOS/macOS)
  • Bash ≥ 4.x
  • Installed utilities: mail, curl, jq, awscli, kubectl, docker, git
  • Jenkins API token (for Jenkins-related scripts)
  • AWS credentials configured (aws configure)

💡 Use Cases

  • Automate CI/CD Deployments
  • Monitor System Health
  • Manage Kubernetes Rollouts
  • Fetch Build Status via Jenkins API
  • AWS Resource Health Checks
  • Log Maintenance and Cleanup

🏷️ Tags

#DevOps #ShellScripting #Automation #AWS #Kubernetes #Jenkins #CI/CD #Monitoring


👨‍💻 Author

Avula Ramesh
DevOps Engineer | AWS | Python | Jenkins | Kubernetes
📍 Bangalore, India

💼 LinkedIn
📧 ramesh@example.com


⭐ Contribute

Feel free to fork this repo and enhance it with:

  • Advanced monitoring (Prometheus or Grafana triggers)
  • Logging to S3 buckets
  • Integration with Slack or Teams for alerts

Pull requests are welcome!


📜 License

This project is open-source under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages