2026-04-18 23:31:17 -03:00
2026-04-19 00:24:47 -03:00
2026-04-18 23:31:23 -03:00
2026-04-18 23:31:16 -03:00
2026-04-19 00:24:44 -03:00

Bash DevOps Portfolio

This repository is a curated collection of production-minded Bash scripts for common DevOps and platform operations tasks. The goal is to demonstrate practical shell scripting, defensive automation, clear documentation, and operational judgement.

What Is Included

Script Purpose
scripts/cleanup_old_files.sh Deletes files older than a defined number of days, with dry-run mode by default.
scripts/server_health_check.sh Runs a complete but simple server health check covering CPU, memory, disk, network, ports, and processes.
scripts/ssh_server_menu.sh Opens an interactive menu with a list of servers and connects to the selected host through SSH.
scripts/system_health_report.sh Collects CPU, memory, disk, network, and service health into a readable report.
scripts/docker_cleanup.sh Safely removes unused Docker resources with dry-run support and retention controls.
scripts/postgres_backup.sh Creates compressed PostgreSQL backups with validation and retention cleanup.
scripts/deploy_static_site.sh Deploys static assets atomically with rollback-friendly release directories.
scripts/tls_certificate_check.sh Checks HTTPS certificate expiry for one or more domains.
scripts/log_rotate_archive.sh Archives and compresses old logs without relying on system logrotate configuration.
scripts/linux_user_bootstrap.sh Creates a Linux user with SSH key access and optional sudo membership.

Repository Principles

  • Scripts are documented in English and include usage examples.
  • Scripts use strict mode where practical: set -Eeuo pipefail.
  • Dangerous operations support a dry-run mode when appropriate.
  • Inputs are validated before actions are executed.
  • Output is designed for humans first, but remains easy to parse in CI logs.
  • Dependencies are intentionally minimal and based on common Linux tooling.

Quick Start

Clone the repository and inspect the scripts:

git clone https://git.elevartech.com.br/elevartech/bash.git
cd bash
ls scripts

Run a script with help:

bash scripts/cleanup_old_files.sh --help

Run the simpler examples:

bash scripts/cleanup_old_files.sh --path /var/tmp/app --days 30 --dry-run
bash scripts/server_health_check.sh
bash scripts/ssh_server_menu.sh

Run the syntax validation helper:

bash tests/syntax_check.sh

Before using any script in production:

  1. Read the script header and usage examples.
  2. Run it with --help.
  3. Prefer --dry-run for scripts that change state.
  4. Test in a staging environment.
  5. Review required permissions and environment variables.

Portfolio Notes

These scripts are intentionally general-purpose. In a real company environment, they would usually be adapted to fit:

  • Monitoring and alerting tools.
  • Backup destinations and retention policies.
  • Deployment topology.
  • Secret management standards.
  • Change control and approval workflows.

All Bash scripts in this repository are based on work already used in large companies during professional service contracts. Before being published here, they were carefully reviewed and sanitized to remove sensitive data, customer identifiers, internal infrastructure details, hostnames, credentials, network ranges, and any other information that could expose or identify the companies involved.

The value demonstrated here is not only Bash syntax. It is the operational discipline around automation: predictable inputs, explicit failure modes, safe defaults, readable logs, and documentation that helps another engineer maintain the work.

S
Description
Production-minded Bash scripts for a DevOps portfolio.
Readme 51 KiB
Languages
Shell 100%