Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scripts

Practical scripts, SQL queries, and configuration examples for Linux, infrastructure, databases, security, monitoring, and data analysis.

Review every script before running it, test against non-production systems, and adapt paths, credentials, permissions, thresholds, and retention to your environment.

Quick Start

git clone https://github.com/sinsausti/Scripts.git
cd Scripts
./tests/run-tests.sh
./bash/system-health-report.sh -o health.txt

Destructive or state-changing examples use a dry run by default where practical. Generated reports, snapshots, manifests, and backup files may contain sensitive information.

Bash

Use -h for Bash command help. Most scripts return 0 for success, 1 for a detected operational problem, and 2 for invalid input or a missing prerequisite.

./bash/system-health-report.sh -o health.txt
./bash/network-baseline.sh -o baseline.txt
./bash/incident-snapshot.sh -o incident-2026-09-05 --sudo
./bash/tls-check.sh -w 30 example.com:443
./bash/proxmox-lxc-clone.sh --source 9000 --first-id 110 --count 3 \
  --hostname-prefix lab
./bash/mysql-logical-backup.sh --host db.example.net --database app \
  --defaults-file "$HOME/.my.cnf" --output-dir /backup/mysql
./bash/postgres-logical-backup.sh --host db.example.net --database app \
  --output-dir /backup/postgresql
./bash/database-restore-test.sh --engine postgresql --backup app.dump
./bash/backup-metrics.sh --path /backup/postgresql --job postgresql \
  --output /var/lib/node_exporter/textfile_collector/backup.prom
./bash/sync-directories.sh --remote user@server --source /srv \
  --target /backup --subdir data

Python

The Python tools use only the standard library and require Python 3.9 or newer.

./python/csv-profile.py metrics.csv
./python/latency-summary.py metrics.csv --column duration_ms
./python/checksum-manifest.py create backups SHA256SUMS
./python/checksum-manifest.py verify backups SHA256SUMS
./python/ssh-run.py admin@db1 admin@db2 --command 'uptime'
./python/disk-growth-forecast.py examples/disk-growth.csv \
  --capacity 107374182400 --group-column filesystem
./python/certificate-inventory.py example.com:443 --json
./python/config-drift-check.py create baseline.json /etc/ssh /etc/mysql
./python/config-drift-check.py verify baseline.json
./python/log-redactor.py application.log -o application.redacted.log

SQL

SQL files are templates. Confirm engine version, privileges, object names, query plans, and production impact before running them.

Configuration Examples

Protect a populated MySQL option file with mode 0600. Never commit it.

Validation

Run the dependency-free test suite from the repository root:

./tests/run-tests.sh

The suite checks Bash syntax, command help, and the Python tools with temporary fixtures. SQL templates still require review and testing against the intended database version.

Requirements

  • Operational Bash tools target modern Linux distributions and Bash 4 or newer.
  • Python tools require Python 3.9 or newer and use only the standard library.
  • Individual scripts report missing external commands before doing work.
  • MySQL and PostgreSQL templates must be matched to the deployed server version.
  • Restore tests require a running Docker-compatible daemon and may pull database images.
  • Linux-specific collectors assume GNU core utilities and systemd where documented.

About

Practical Bash, Python, and SQL tools for Linux, databases, infrastructure, security, monitoring, and data analysis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages