Backup Script Generator
Source, destination, compression, and retention - a complete, runnable backup script for Bash or PowerShell.
#!/bin/bash # Backup script generated by ArchSetu # Backs up "/path/to/source" to "/path/to/backups", keeping the last 7 backups. set -euo pipefail SOURCE="/path/to/source" DEST="/path/to/backups" RETENTION=7 TIMESTAMP=$(date +%Y%m%d_%H%M%S) BACKUP_NAME="backup_$TIMESTAMP.tar.gz" # Make sure the destination directory exists mkdir -p "$DEST" # Create the compressed archive tar -czf "$DEST/$BACKUP_NAME" "$SOURCE" echo "Created $DEST/$BACKUP_NAME" # Delete old backups beyond the retention count cd "$DEST" ls -1t backup_*.tar.gz 2>/dev/null | tail -n +$((RETENTION + 1)) | xargs -r rm -- echo "Backup complete - keeping the 7 most recent backups."
To automate with cron
Save the script to /path/to/backup.sh, make it executable (chmod +x), then add this line via crontab -e:
0 2 * * * /path/to/backup.sh
Was this tool helpful?
See this same kind of analysis applied to your whole repository
Call graphs, dead code, blast radius, and a health score. Results in 60 seconds, free.
Related tools
See all Linux tools →Cron ↔ Natural Language Converter
Cron syntax to plain English, and back.
chmod File Permission Calculator
Pick read/write/execute per owner/group/other - the numeric and symbolic chmod value.
Cron to systemd Timer Converter
Paste a cron expression - the equivalent systemd OnCalendar= line for a .timer unit.
Bash Strict Mode Header Generator
Pick set -e, set -u, pipefail, safe IFS, and an error trap - a commented script header.
Environment Variable Naming Checker
Check a name against portable POSIX conventions - UPPER_SNAKE_CASE, no hyphens, no leading digit.
Runs entirely in your browser. Nothing is stored. Free forever.
