Backup tool for cheap C14 storage provided by online.net. Support encryption, diff backups and backup rotation. Description and prices here: https://www.online.net/en/c14.
Inspired by BackInTime
- Multi profile configuration
- Exclude folders and files
- Client-side encryption
- Backup rotations
PHP >= 5.6
rsync
encfs (+encfstools)
sshfs
ssh
ssh-keygen
cron
composer
fabiang/xmpp
Without xmpp logs and composer
git clone https://github.com/TheSaturn/C14BackupTool.git
cd C14BackupTool
cp config.example.php config.php
If you want get logs by xmpp:
composer create-project thesaturn/c14-backup-tool
cp config.example.php config.php
C14 — Storage type
Safe — Name of archives group in C14
Archive — Contains your files
All possible options described in config.example.php
. Below some tips
config.php
must return array with profilesreturn [...]
- Every profile has its name
return [
'default' => [...],
'books2' => [...],
'books3' => [...],
'books4' => [...],
];
- All paths must be absolute to avoid possible errors
Command line usage: php /path/to/main.php profileName
- Register to online.net
- Add your debit/credit card
- Generate ssh keys (if you don't have them)
ssh-keygen
- Edit config.php as you like
- Test your configuration
- Add backup tool to cron
- Time to time look through archives in safe lists to check size of archives
- Diff backups created only in one archive. So you can always delete any archive without corrupting others
- Storage API is a quite slow and not stable. That is why code try several times to do operations and have sleep() function to wait, while operations will be applied.
- Archive creates for 7 days, but tool make backups only for 6 days since archive created.
- Encfs config file also copied to archive. So you don't need to save it somewhere else.
- If all rotation options is to false, all backups will be saved.
- If encryption enabled, exclude working with only absolute paths, regex is not available
- Better config validation
- Dependencies checking
- Tests
- Send a message about backup starting "Backup started for safe"
- Find a safe with safe name (set up in config)
- Find an archive in the safe to store backups
- Create necessary folders
- Mount encfs (encrypted view of the root FS)
- Encrypt included and excluded file names (for rsync)
- Mount the archive (sshfs)
- Clean up backup_temp folder (if last backup was unsuccessful)
- Copy hard links from the last backup folder
- Send the message "YAY! The real backuping is starting!"
- rsync
- rename backup_temp to C14ABT/$date
- Write date of successful backup to description of the archive
- Send "Backup success."
- Unmount sshfs and encfs