feat: ayaka supremacy

This commit is contained in:
2026-03-12 19:41:34 +07:00
parent 2ec777f8d5
commit a1bdc79343
4 changed files with 123 additions and 0 deletions

19
os/linux/backup.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Check if current user is root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root."
exit 1
fi
mkdir -p /mnt/backup
cd /mnt/backup
current_date=$(date +%F)
# Backup
echo "Creating backup of @root subvolume..."
btrfs subvolume snapshot -r @root @root_backup_$current_date
# Remove backups older than 7 days
echo "Removing backups older than 7 days..."
find /mnt/backup -maxdepth 1 -type d -name '@root_backup_*' -mtime +7 -exec "echo 'Removing {}' && btrfs subvolume delete {}" \;
echo "Backup completed successfully."