projects
pds-backup
February 24, 2026
pds-backup is a Bash script that automates backups of your AT Protocol Personal Data Server. It stops the PDS service, creates a timestamped .tar.gz archive of /pds, compares SHA-256 checksums against the most recent remote backup to skip unchanged runs, transfers via rsync over SSH (with up to 3 retries), then restarts the PDS. Cron jobs are installed automatically for twice-daily runs at midnight and noon.
Requirements
- Linux with systemd (
systemctlfor PDS service management) - Root privileges (
sudo) - Passwordless SSH configured to the destination machine
- The bluesky-social/pds server installed
Configuration
Edit the variables at the top of the script:
SOURCE_DIR="/pds" # PDS data directory
DEST_USER="user" # Destination SSH username
DEST_IP="192.168.1.100" # Destination IP
DEST_BASE_DIR="/path/to/remote/backup" # Remote backup root
MAX_RETRIES=3
RETRY_INTERVAL=60
What Happens on Each Run
- Pings the destination to check it's reachable
- Stops the PDS service
- Creates a timestamped
.tar.gzofSOURCE_DIR - Compares SHA-256 checksum against the latest remote backup — skips transfer if unchanged
- Creates a timestamped directory on the remote and transfers via rsync
- Deletes the local archive on success
- Removes remote backup directories older than 30 days
- Rotates local logs (>1000 lines or >30 days old); deletes logs older than 90 days
- Restarts the PDS service
- Updates the crontab for midnight and noon daily runs
If any step fails, the script attempts to restart the PDS service before exiting to minimise downtime.
Usage
sudo ./pds-backup.sh
Cron jobs are installed automatically on each run. Monitor logs:
tail -f /path/to/script/logs/pds-backup/*.log
Licence
See repository.
← all docs