بنقرة واحدة
backup
Backup and restore — files, databases, and system backups
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Backup and restore — files, databases, and system backups
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Google Calendar — list, create, and manage events via gcal CLI
Manage HubSpot CRM — contacts, companies, deals, tickets
Manage Shopify store — products, orders, customers, inventory
Configure audio transcription and image/video understanding for channels
AWS CLI for S3, EC2, Lambda, CloudWatch, RDS, and ECS
Google Calendar — list, create, and manage events via gcal CLI
| name | backup |
| version | 0.1.0 |
| author | devclaw |
| description | Backup and restore — files, databases, and system backups |
| category | system |
| tags | ["backup","restore","archive","recovery","sync"] |
| requires | {"bins":["rsync","tar"]} |
Backup and restore files, databases, and systems.
Base tools (often pre-installed):
brew install postgresql mysql (pg_dump, mysqldump), brew install mongodb/brew/mongodb-database-tools (mongodump)sudo apt install rsync (tar usually included), sudo apt install postgresql-client default-mysql-client mongodb-database-tools for DB backupsCloud: rclone config for multi-cloud; aws configure for S3.
# Basic sync
rsync -av /source/ /backup/
# With progress
rsync -av --progress /source/ /backup/
# Exclude patterns
rsync -av --exclude 'node_modules' --exclude '.git' --exclude '*.log' /source/ /backup/
# Remote backup
rsync -avz -e ssh /source/ user@remote:/backup/
# Delete files not in source (mirror)
rsync -av --delete /source/ /backup/
# Dry run
rsync -av --dry-run /source/ /backup/
# Backup with date
rsync -av --backup --backup-dir=/backup/$(date +%Y%m%d) /source/ /backup/current/
# Create archive
tar -czvf backup.tar.gz /path/to/backup/
# With exclude
tar -czvf backup.tar.gz --exclude='*.log' --exclude='node_modules' /path/
# Split large archives
tar -czvf - /path/ | split -b 1G - backup.tar.gz.
# Verify archive
tar -tzvf backup.tar.gz
# Extract
tar -xzvf backup.tar.gz -C /destination/
# Incremental tar
tar --create --file=backup.tar --listed-incremental=backup.snar /path/
# Full backup
pg_dump -h localhost -U user dbname > backup.sql
# Compressed
pg_dump -h localhost -U user dbname | gzip > backup.sql.gz
# All databases
pg_dumpall -U postgres > all_databases.sql
# Custom format (better for large DBs)
pg_dump -h localhost -U user -Fc dbname > backup.dump
# Restore from SQL
psql -h localhost -U user dbname < backup.sql
# Restore from custom format
pg_restore -h localhost -U user -d dbname backup.dump
# Single database
mysqldump -u user -p dbname > backup.sql
# All databases
mysqldump -u user -p --all-databases > all_databases.sql
# With gzip
mysqldump -u user -p dbname | gzip > backup.sql.gz
# Specific tables
mysqldump -u user -p dbname table1 table2 > tables.sql
# Restore
mysql -u user -p dbname < backup.sql
# Export database
mongodump --uri="mongodb://user:pass@host/dbname" --out=backup/
# Export specific collection
mongodump --uri="mongodb://host/dbname" --collection=users --out=backup/
# Import database
mongorestore --uri="mongodb://host/dbname" backup/dbname/
# Export to JSON
mongoexport --uri="mongodb://host/dbname" --collection=users --out=users.json
# Edit crontab
crontab -e
# Daily backup at 2 AM
0 2 * * * rsync -av /source/ /backup/ >> /var/log/backup.log 2>&1
# Weekly full backup
0 3 * * 0 tar -czvf /backup/weekly-$(date +\%Y\%m\%d).tar.gz /source/
# Monthly database backup
0 4 1 * * pg_dump -U user dbname | gzip > /backup/db-$(date +\%Y\%m).sql.gz
#!/bin/bash
# backup.sh
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_DIR="/backup/$DATE"
SOURCE="/data"
mkdir -p "$BACKUP_DIR"
# Files
rsync -av "$SOURCE/" "$BACKUP_DIR/files/"
# Database
pg_dump -U user mydb | gzip > "$BACKUP_DIR/database.sql.gz"
# Cleanup old backups (keep last 7)
find /backup -type d -mtime +7 -exec rm -rf {} \;
echo "Backup completed: $BACKUP_DIR"
# Sync to S3
aws s3 sync /local/ s3://bucket/backup/
# With glacier storage
aws s3 sync /local/ s3://bucket/backup/ --storage-class GLACIER
# Restore from S3
aws s3 sync s3://bucket/backup/ /local/
# Setup
rclone config
# Sync to Google Drive
rclone sync /local/ gdrive:backup/
# Sync to Dropbox
rclone sync /local/ dropbox:backup/
# Encrypted backup
rclone sync /local/ crypt:backup/
--dry-run before running backupsbackup, restore, rsync, database backup, file backup, pg_dump, mysqldump, archive