Skip to content

πŸš€ A curated collection of production-ready Bash scripts for DevOps, system administration, and automation tasks. Includes monitoring, backup, deployment, and alerting scripts for Kubernetes, Docker, Jenkins, ArgoCD, and more! πŸ› οΈ

License

Notifications You must be signed in to change notification settings

wesleyscholl/bash-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Bash Scripts Collection

A comprehensive collection of production-ready Bash scripts for DevOps engineers, system administrators, and automation enthusiasts. These scripts handle everything from system monitoring and backups to Kubernetes management and CI/CD integrations.

License: MIT Shell

bash

πŸ“‹ Table of Contents

🎯 Overview

This repository contains battle-tested Bash scripts designed to automate common tasks in modern infrastructure management. Whether you're managing bare-metal servers, cloud infrastructure, or containerized applications, you'll find utilities to streamline your workflow.

πŸ“œ Scripts

System Administration

Script Description
account-expiry-notify.sh Monitors and notifies about upcoming user account expirations
user-account-management.sh Automates user account creation, modification, and deletion
package-updates.sh Checks for and manages system package updates
system-resource-monitor.sh Monitors CPU, memory, and disk usage with threshold alerts
system-monitoring.sh Comprehensive system health monitoring script
health-check.sh Performs system health checks and reports status
http-status.sh Checks HTTP endpoint status and availability
monitor-open-ports.sh Scans and monitors open network ports
process-monitor-alert.sh Monitors specific processes and alerts on failures

DevOps & CI/CD

Script Description
jenkins-job.sh Triggers and manages Jenkins job executions
argo-cd-sync.sh Synchronizes ArgoCD applications
auto-deployment.sh Automates application deployment workflows
sonarqube-slack-notify.sh Sends SonarQube analysis results to Slack
create-confluence-page.sh Creates and updates Confluence documentation pages
git-repo-stats.sh Generates comprehensive Git repository statistics

Monitoring & Alerting

Script Description
disk-usage-monitor.sh Monitors disk usage and sends alerts on thresholds
grafana-metrics.sh Pushes custom metrics to Grafana
slack-notify.sh Sends notifications to Slack channels
splunk-search.sh Performs automated Splunk log searches
check-ssl-expiry.sh Monitors SSL certificate expiration dates
docker-log-monitor.sh Monitors and analyzes Docker container logs

Backup & Recovery

Script Description
backup.sh Performs weekly automated backups
rsync-backup.sh Uses rsync for efficient incremental backups
scp-remote-backup.sh Securely copies backups to remote servers
rotate-old-files.sh Implements file rotation policies
log-rotation.sh Manages log file rotation and archival
log-file-cleanup.sh Cleans up old log files based on retention policies

Container & Kubernetes

Script Description
kubectl-namespace-cleanup.sh Cleans up unused Kubernetes namespaces
scale-deployment.sh Scales Kubernetes deployments automatically
restart-containers.sh Restarts Docker containers based on criteria
gc-cleanup.sh Performs garbage collection and cleanup tasks

Utilities

Script Description
random-password-generator.sh Generates secure random passwords

πŸ”§ Prerequisites

  • Bash 4.0 or higher
  • Standard Unix utilities (grep, awk, sed, etc.)
  • Specific tools required by individual scripts:
    • kubectl for Kubernetes scripts
    • docker for container management scripts
    • curl or wget for HTTP-based scripts
    • jq for JSON parsing (some scripts)
    • rsync for backup scripts
    • API tokens/credentials for integration scripts (Jenkins, Slack, etc.)

πŸ“₯ Installation

  1. Clone the repository:
git clone https://github.com/wesleyscholl/bash-scripts.git
cd bash-scripts
  1. Make scripts executable:
chmod +x *.sh
  1. (Optional) Add scripts to your PATH:
export PATH=$PATH:$(pwd)

Or copy scripts to /usr/local/bin/:

sudo cp *.sh /usr/local/bin/

πŸš€ Usage

Each script includes inline documentation and usage examples. Run any script with the -h or --help flag for detailed information:

./backup.sh --help

Example: SSL Certificate Monitoring

./check-ssl-expiry.sh example.com 443

Example: Disk Usage Monitoring

./disk-usage-monitor.sh /dev/sda1 80

Example: Kubernetes Namespace Cleanup

./kubectl-namespace-cleanup.sh --dry-run

πŸ“ Configuration

Many scripts support configuration through:

  • Environment variables
  • Configuration files (.conf or .env files)
  • Command-line arguments

Check individual script documentation for specific configuration options.

🀝 Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-script)
  3. Commit your changes (git commit -m 'Add amazing script')
  4. Push to the branch (git push origin feature/amazing-script)
  5. Open a Pull Request

Script Guidelines

  • Include error handling and input validation
  • Add usage documentation and examples
  • Follow consistent naming conventions
  • Test thoroughly before submitting
  • Include comments for complex logic

πŸ”’ Security

  • Never commit sensitive credentials or tokens
  • Use environment variables or secure vaults for secrets
  • Review scripts before running in production
  • Follow the principle of least privilege

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built by @wesleyscholl with contributions from the community
  • Thanks to all contributors who help improve these scripts

πŸ“ž Support

  • Open an issue for bug reports
  • Start a discussion for questions
  • Check existing scripts for examples and patterns

⭐ Star this repository if you find it useful!

About

πŸš€ A curated collection of production-ready Bash scripts for DevOps, system administration, and automation tasks. Includes monitoring, backup, deployment, and alerting scripts for Kubernetes, Docker, Jenkins, ArgoCD, and more! πŸ› οΈ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages