Skip to content

Instantly share code, notes, and snippets.

@NotYusta
Last active March 23, 2025 02:16
Show Gist options
  • Save NotYusta/76fd5c2a0491abcf2189b17c3d7f14ab to your computer and use it in GitHub Desktop.
Save NotYusta/76fd5c2a0491abcf2189b17c3d7f14ab to your computer and use it in GitHub Desktop.
Start Database Backup
#!/bin/sh
DIR_PATH="$HOME/database-backup"
OUTDIR_PATH="$DIRPATH/out"
CLEAR_PERIOD="7"
cd $DIR_PATH
# Ensure the output directory exists
mkdir -p "$OUTDIR_PATH"
# Make sure the backup script is executable
chmod +x database_backup_linux_amd64
# Run the backup
./database_backup_linux_amd64
# Delete backups older than CLEAR_PERIOD days
find "$OUTDIR_PATH" -type f -mtime +"$CLEAR_PERIOD" -exec rm {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment