GHOSTVPS / Backups
Schedule VPS backups and prove you can restore them
Turn a one-off file transfer into a repeatable backup process with logs, retention and a safe restore test.
Updated · GhostVPS

Before you start
A VPS, a separate backup destination you control, enough capacity and an authentication method that works without typing a password during scheduled runs. Confirm the destination access protocol in your own service before using example commands.
Choose what must be recoverable
List application files, uploaded media, configuration and databases separately. A live database file may not be safe to copy while it is being written; use an application-consistent dump or the database backup procedure for your stack. Decide how many daily and weekly versions you need before scheduling.
Run a manual dry run first
Use the existing Storage Box rsync tutorial to establish an authorized destination. For a file tree, run rsync with –dry-run and inspect source and destination paths. A trailing slash changes how the source directory is represented. Avoid –delete until you understand its effect and have a separate versioned copy.
Your VPS · Linux terminal
rsync -a --dry-run /srv/app/files/ BACKUP_USER@BACKUP_HOST:BACKUP_PATH/files/

Create a repeatable command and log failures
Put the verified command in a root-owned script with restrictive permissions and an explicit log destination. Replace every uppercase placeholder before running the example script. Use an SSH key or other supported non-interactive authentication; never place a password in the script. Test the script manually and confirm a nonzero exit code is reported as failure.
File contents
#!/bin/sh
set -eu
rsync -a /srv/app/files/ BACKUP_USER@BACKUP_HOST:BACKUP_PATH/files/
Schedule only after the manual test passes
After saving the script as /usr/local/sbin/backup-app.sh and testing it, set owner root and mode 700. Add a root cron entry at a low-traffic time, or use a systemd timer with equivalent logging. Check the next run actually occurred and inspect its exit status; a scheduled job that silently fails is not a backup. Keep at least one copy separate from the VPS.
File contents
15 2 * * * /usr/local/sbin/backup-app.sh >> /var/log/backup-app.log 2>&1

Restore a disposable file and review retention
Restore one known file to a new temporary directory, compare its checksum or contents, and remove the temporary copy when done. Repeat this test after changing paths or credentials. Review retention and storage use; a sync mirror alone can propagate accidental deletion or corruption, so keep versioned history for critical data.
Your VPS · Linux terminal
rsync -a --dry-run BACKUP_USER@BACKUP_HOST:BACKUP_PATH/files/ /tmp/restore-check/



