Skip to content

Instantly share code, notes, and snippets.

View antoniosmgatto's full-sized avatar
🏠
Working from home

Antonio Gatto antoniosmgatto

🏠
Working from home
View GitHub Profile
@antoniosmgatto
antoniosmgatto / postgres-bkp.sh
Created October 4, 2021 15:13
Postgres backup with gzip support and upload to S3/Digital Ocean Spaces
#!/bin/bash
WORKSPACE_DIR="/tmp/postgres_bkp"
DB_URL="$1"
BACKUP_FILENAME="$2"
S3_CMD=$(which s3cmd)
SPACES_BUCKET="your-bucket-here"
if [ -z "$DB_URL" ] || [ -z "$BACKUP_FILENAME" ]; then
echo "You must set database connection and output filename !!!";
@antoniosmgatto
antoniosmgatto / mysql-backup.sh
Last active December 28, 2021 01:01
Mysql backup script
#!/bin/bash
# errexit -> exit when any command fails
set -o errexit
# will fails exit if an pipe command fails
set -o pipefail
# nounset -> exit when an unsed variable is used
set -o nounset