autopostgresqlbackup
- ai autopostgresqlbackup
- dpkg -L autopostgresqlbackup
- mkdir /var/backups/autopostgresqlbackup
- vim /etc/default/autopostgresqlbackup
- /usr/sbin/autopostgresqlbackup
- l /var/backups/autopostgresqlbackup/*/*
PeerTube
- https://docs.joinpeertube.org/maintain/migration
- vim $(which autopostgresqlbackup) +361 #367
- su $SU_USERNAME -l -c "pg_dump -Fc $PGHOST $OPT $db -f $2"
- pg_dump -Fc --username=$USERNAME $PGHOST $OPT $db -f $2
Backup and Restore of Manually Installed APT Packages
Backup and Restore of Manually Installed APT Packages
This documentation describes how to save and restore manually installed APT packages on a Debian-based system.
It uses the apt-mark showmanual command to generate a clean list of user-installed packages, which can be used to restore or clone systems.
Overview
A list of manually installed packages is created and stored at:
/etc/apt/packages.listThis file is overwritten each time the backup tool is executed.
borg
- https://torsion.org
- ai borgbackup
- USERHOST=USER@IP-BACKUPSERVER
init
- borg init --encryption=repokey $USERHOST
- borg key export $USERHOST | tee ~/.borg_passphrase
Change the Passphrase
- export BORG_REPO="ssh://$USERHOST/home/borg/$HOST"
- borg key change-passphrase
ssh keys
- ssh-keygen -t ed25519
- ssh-copy-id -i .ssh/id_ed25519.pub $USERHOST
- chmod 600 .ssh/id_ed25519
- eval "$(ssh-agent -s)"
- ssh-add .ssh/id_ed25519
borg_backup.sh
#!/bin/sh
# Version: 1.2
# Description: Automates Borg backup process with logging, error handling,
# and repository initialization if required.
set -e
# =============================================================================
# Configuration
# =============================================================================
# Hostname setup
FULL_HOSTNAME=$(hostname)
SHORT_HOSTNAME=$(hostname -s)
# Passphrase file
BORG_PASSPHRASE_FILE=~/.borg_passphrase
# SSH key file location
SSH_KEY="/root/.ssh/id_ed25519"
# Backup server
REPO_SERVER=borg_list_backups.sh
#!/bin/zsh
# Script Version: 02
# Description: List available Borg backups in the specified repository
# Set variables
# ========
REPO1="ssh://"
BORG_PASSPHRASE_FILE="/root/.borg_passphrase"
# Functions
# ========
log_message() {
echo "$(date +"%Y-%m-%d %H:%M:%S") - $1"
}
# Main Process
# ========
log_message "Listing available backups in repository."
# Ensure Borg passphrase file is available
if [ -f "$BORG_PASSPHRASE_FILE" ]; then
export BORG_PASSPHRASE=$(<"$BORG_PASSPHRASE_FILE")
else
log_message "Borg passphrase file not found."
borg_list_archives.sh
#!/bin/bash
# Version: 1.0
# Description: This script lists all the archives in a Borg repository
set -euo pipefail
# Check if whiptail is installed
if ! command -v whiptail &> /dev/null; then
echo "whiptail is required but not installed.lxc_snapshot_create.sh
#!/bin/bash
# v01
# List and check LXC containers
echo "Listing all LXC containers..."
CONTAINERS=($(lxc-ls -1))
# Check if there are any containers
if [[ ${#CONTAINERS[@]} -eq 0 ]]; then
echo "There are no LXC containers."
exit 1
fi
echo "Found ${#CONTAINERS[@]} container(s): ${CONTAINERS[@]}"
echo "----------------------------------"
# Loop over each container
for LXCHOSTNAME in "${CONTAINERS[@]}"; do
echo "Processing container: $LXCHOSTNAME"
# Stop the container
echo "Stopping container $LXCHOSTNAME..."
if !rsnapshot
rsnapshot.conf - no SPACES only TABS!
borg_list.sh
#!/bin/bash
# Script Version: 1.0
# Description: This script searches through BorgBackup archives for files matching a specific pattern.
set -euo pipefail
# Variables
HOSTNAME=$(hostname)
BORG_PASSPHRASE_FILE="$HOME/.borg_passphrase"
SSH_KEY="/root/.ssh/id_ed25519_$HOSTNAME"
REPO1=".at:/./borg"
LOG="/var/log/borg_find.log"
PATTERN="${1:-}" # File pattern to search for (provided as the first argument)
# Load Borg passphrase
if [ -f "$BORG_PASSPHRASE_FILE" ]; then
export BORG_PASSPHRASE=$(cat "$BORG_PASSPHRASE_FILE")
else
echo "Passphrase file not fouborg_backup_hetzner.sh
#!/bin/sh
# =============================================================================
# Script Name: borg_backup_hetzner.sh
# Version: 1.2
# Author: Andreas Fleckl
# Description: This script performs backups using Borg to a Hetzner Storage Box.
# It reads directories to backup and exclude from specified files,
# handles logging, performs pruning of old backups, and sends
# notifications about the backup status.
# =============================================================================
# Backup repository locautomysqlbackup
- ai automysqlbackup
- vim /etc/default/automysqlbackup
- BACKUPDIR="/var/backups/automysqlbackup"
- mkdir /var/backups/automysqlbackup
- /etc/cron.daily/automysqlbackup
- l /var/backups/automysqlbackup/daily/*/
- omz plugin info extract
restore
- unpack /var/backups/automysqlbackup/INTERVAL/DB-NAME/DB_INTERVAL_DATE.sql.COMPRESSION
- bzip2 -dk .sql.bz2
- gunzip .sql.gz
- extract FILE
- mysql -u root -p DB-NAME < /var/backups/automysqlbackup/INTERVAL/DB
/etc/rsnapshot_include
apache2/
nginx/
letsencrypt/live/
/etc/rsnapshot_exclude
.Spam/
.Trash/
.cache/yarn/
.cpan/
.cpanm/
.npm/
.oh-my-zsh/
# Mails
USERNAME/Maildir
# Dir
*-enabled/
alternatives/
cache/
certs/
goaccess/
ipsets/
php/
rc0.d/
rc?.d/
systemd/
# drupal
vendor/
modules/
web/core/
web/themes/
shop/bin/
files/css/
files/js/
files/php/twig/
files/translations/
files/asset_injector/
fonts/
shariff/
core/
# File Type
*.gz
*.lock
*.reason
*.swp
.rnd
backup installed packages
backup
- dpkg --get-selections > dpkg.txt
restore
- dpkg --clear-selections
- dpkg --set-selections < dpkg.txt
- apt-get autoremove
- apt-get dselect-upgrade