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.
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).
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 
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 
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 
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 
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 
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 
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 
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 
File: k8s_restart_pod.sh
Restarts a deployment safely and checks rollout completion.
- Key Tools: kubectl rollout restart
- Usage:
bash k8s_restart_pod.sh 
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 
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 
- ✅ set -euo pipefailfor 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
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
- 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)
- Automate CI/CD Deployments
- Monitor System Health
- Manage Kubernetes Rollouts
- Fetch Build Status via Jenkins API
- AWS Resource Health Checks
- Log Maintenance and Cleanup
#DevOps #ShellScripting #Automation #AWS #Kubernetes #Jenkins #CI/CD #Monitoring
Avula Ramesh
DevOps Engineer | AWS | Python | Jenkins | Kubernetes
📍 Bangalore, India
💼 LinkedIn
📧 ramesh@example.com
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!
This project is open-source under the MIT License.