dotfile / db-backup

~/bin/db-backup Commits Diff Raw
#!/usr/bin/env bash
set -e

bucket=dotfilehub-backup
db_path=~/prod.db
backup_name="$(date +%Y-%m-%d@%H:%M)"
bucket_path="s3://$bucket/$backup_name"

if ! [ -x "$(command -v aws)" ]; then
  echo "error: aws cli isn't installed." >&2
  exit 1
fi

if ! [ -r "$db_path" ]; then
  echo "error: $db_path not found" >&2
  exit 1
fi


aws s3 cp "$db_path" "$bucket_path"